Documentation > Templates

Templates

A Template is a set of template files that hook into specific cms events and represent a specific page type such as Article and Home pages. Templates are associated with assets and when actions are performed upon the associated asset the appropriate template file, if present, will be invoked depending upon the event caused by the action. Actions can be caused by user interaction, automated processes, and publishing.


Formatted by Filename, Context and Description. Below is the complete list of supported template files and its purpose.

new.aspx   |   InputContext

Used to initialize variables when a new page is created for the first time. For example: asset["title"] = "Title Initialized In new.aspx";

input.aspx   |   InputContext

Used to specify the content entry input form

upload.aspx   |   UploadContext

Triggered when a media file is uploaded in an input form. Use this file create thumbnails of uploaded assets and save them into the asset.

post_input.aspx   |   PostInputContext

Triggered when a user clicks on save in an input form. At this point, the data has not yet been saved. Useful for field checking or post processing, such as field validation. For example ensuring that value had been entered for the title field if not, set the ValidationError on the context to return the user back to the input screen. (context.ValidationError = "Please enter a title") NOTE: setting this value does not stop execution of the post_input, if there is is any code further down that requires that the field should be present, you must check if it exists before trying to use it. Setting the ValidationError will also prevent the data from being saved.

post_save.aspx   |   PostSaveContext

Used to process data submitted from the input.aspx file AFTER the information has been saved as opposed to post_input.aspx which is called before saving the information.

preview.aspx   |   OutputContext

Used to override the output.aspx. It is active only during a preview and cannot be published. This is useful when previewing an asset with an output.aspx that contains server-side code that is being rendered on the live server and would otherwise not appear in the CMS. If the template does not contain a preview.aspx, the output.aspx will be used.

output.aspx   |   OutputContext

Used to specify the published content in site HTML. If no preview.aspx exists, then this is used by default for preview

copy.aspx   |   CopyContext

Triggered when an asset is copied, pasted, branched or cloned. Use this if you need to update any dependent assets when an asset is cloned.

delete.aspx   |   DeleteContext

Triggered when an asset is deleted. Use this if you need to update any dependent assets upon deletion.

url.aspx   |   OutputContext

Used to set the URL independently of the physical filename. To override the url, set the PublishUrl property on the context object to the desired url. (context.PublishUrl = myUrl;)

filename.aspx   |   OutputContext

Used to set the filename via code. To override the published file name, set the PublishPath property on the context object to the desired path. (context.PublishPath = myPath;)

asseturl.aspx   |   OutputContext

Used to set the urls for media assets that were uploaded into the currently publishing asset. To override set the PublishUrl property on the context object to the desired url. (context.PublishUrl = myUrl;)

assetfilename.aspx   |   OutputContext

Used to set the filename for media assets that were uploaded into the currently publishing asset. To ovveride set the PublishPath property on the context object to the desired path. (context.PublishPath = myPath;)

post_publish.aspx   |   PostPublishContext

Triggered after the asset has been published.

ftp_import.aspx   |   FtpImportContext

Used to import remote FTP files into the CMS by polling remote FTP sites.

smtp_import.aspx   |   SmtpImportContext

Used to import data into the cms through smtp. The email body is stored in the Body property on the context object. (context.Body)



Connect with Crownpeak