Skip to main content

Posts

Showing posts from August, 2007

Referencing Embedded Uploads In Another Asset

This breaks the methodology of embedded uploads in that embedded uploads are only supposed to be used by the asset it is embedded in. If you want many assets to be able to use an upload, you should store that upload in say the /Asset/ Directory. However, there is a way around this, but this is based on one assumption. That embedded uploads get stored in the same directory on the live site as the asset itself. Given this, you can do the following. fileName = list.item("the_upload") // This will return the path and filename to the CMS where the upload is stored. // ie. '/Myhorse/01/02/abc.gif' liveSitePath = asset.getLink(list.item("_cmsId")) // This will return the path and filname to the live site where the asset is stored // With the assumption that uploads get saved in the same directory, just do a // little string manipulation and you got it.

Abstracting Out Content Into a Layout

Heres a pattern that abstracts out common code to a single file and publishes out to the live site as an include file. Think snippet of html that gets included in the big file. 1. Create a layout file in any Template, layout.asp (clone out output would work great) 2. Create a filename.asp that checks for the layout and changes publishing path accordingly. This is so this particular layout has different name from output.asp if content.("_cmsLayout") = "layout.asp" then content.add "_cmsPublishPath", replace(content.item("_cmsPublishPath"), "old_val", "new_val" end if 3. In the template we wish to include this code do this if content.isPublishing then asset.setParam "_cmsLayout", "layout.asp" <!--#include virtual="<% asset.getLink("path to asset that uses template with layout.asp file") %>" --> 'when the asset that asset.getLink() is referring to is published, one is publi