OverviewWelcome!This Overview is a general tutorial of the Template system. You can click the menu links on the left if you need to learn about a specific element of the system.The purpose of the Template System Documentation is to help you understand the way the program uses Templates, Placeholders (and Modifiers), and Template Commands to publish and create your content. Generic ExamplesThis documentation is useful for any of our products that use this template system. Since each individual template has it's own applicable Placeholders and TemplateCells (more about them later), we've kept the examples general. The documentation for any specific program has a list of all templates and placeholders available.TemplatesTemplates are HTML files used by the program as a "blueprint" for the content it generates. They are normal HTML with a few custom tags, so that the Templates appear as close as possible to the content generated by the program.You can modify the Templates as easily as any other HTML file, using your favourite text or WYSIWYG web page editor such as HomeSite, UltraEdit, Dreamweaver, FrontPage, etc. (though you might need to make sure your editor isn't configured to remove comments or custom tags). [ learn more... ] PlaceholdersTemplates use Placeholders to tell the program where to insert content. Each placeholder corresponds to different content - usually a single field from a specific record (like the title of an article or the address field for a property listing).You can find out what placeholders are available on any given page by using the templatePlaceholderList command. Placeholders begin and end with a dollar sign ($), making them easy to identify in the templates. Here are some examples of placeholders:
[ learn more... ] templateCellSome sections of HTML are only displayed in specific circumstances. TemplateCells are used to define the boundaries of these sections.The rules for when each TemplateCell is used are part of the program, and most templates won't work correctly if they are removed - though they can be modified however you like. Example: In the following Template code, the "row" templateCell will typically be repeated several times, once each item in a list of records (like a list of products or article headlines). If there is no content in the program to use for the generated page, the "not_found" templateCell will be output instead.
1 $foo$ 2 <!-- templateCell : row --> 3 <p> 4 <a href="$bar$"><b>$baz$</b></a> 5 <br> 6 $bip$</p> 7 <!-- /templateCell : row --> 8 9 <!-- templateCell : not_found --> 10 <p>No items were found</p> 11 <!-- /templateCell : not_found --> TemplateCells are commonly used for repeating code, such as for a list of matches on a search results page or a headlines file. [ learn more... ] templateInsertA templateInsert "hides" the code (usually a Placeholder) from Template View, but the code is displayed normally in Generated View.It makes it easier to work with the templates by modeling your Template View as closely as possible to your Generated View - the templateInsert hides code that looks odd in the Templates, but is resolved when the content is generated. For example, Placeholders with long names can break a table's width, even though the values displayed for those placeholders look fine when the content is generated. Example:
In the Template below, we've used templateInserts to hide placeholders on line 11 and 17.
If the templateInserts weren't there, the table would be expanded to break the Welcome image, making the page design appear broken when the template is viewed from the browser (see templateInsert for more details on this example).
[ learn more... ] templateCommentTemplateComment is mainly used to mark up the templates with instructions or notes to make working with templates easier. They designate a section of code in the template that will be removed when the program generates the content, but when working with the templates themselves, the code is displayed normally.Example: Below, the templateComment in the Template Source Code makes it clear which template you're working with when looking at the file in Template View.
The Generated View shows us that the templateComment was stripped from the page when the program generated the content.
[ learn more... ] templatePlaceholderListThe templatePlaceholderList command generates a complete list of all the placeholders available for the template. This can be very useful when you're making template modifications.
templateIfThe templateIf command is a very powerful tool for "conditional output" - meaning you can specify the code to generate when a placeholder matches (or doesn't match!) a certain value. Example: The code below has two templateIf commands. The text on line 2 will be generated if the $placeholder$ value is Yes, since it matches the first templateIf (the "eq" operator means "equal to"). On any other value for $placeholder$, the text on line 6 will be generated based on the "ne" operator, which means "not equal". All possibilities for $placeholder$ are covered, since it's either equal to "Yes", or it isn't.
1 <!-- templateIf $placeholder$ eq "Yes" --> 2 Lorem Ipsum. 3 <!-- /templateIf --> 4 5 <!-- templateIf $placeholder$ ne "Yes" --> 6 Dolor sit amet. 7 <!-- /templateIf --> The typical format is shown in the example above. Note that:
[ learn more... ] File and Image UploadsMany fields will give your user the ability to upload different file types, either to put into another content field as Embedded Media or publish in a series as Attached Files. When you put an upload field's placeholder into the template you will also need to create a corresponding templateCell for that field. The name for the templateCell is "$PLACEHOLDER.row$". Attributes Attributes for an uploaded file can only be called from its templateCell, and are all called using a placeholder formatted as "$file.ATTRIBUTE$" (Read more about "Attributes" here): Example: <!-- templateCell : uploadedImage.row -->
<img src="$file.webUrl$" width="$file.width$" align="$file.align$">
<!-- /templateCell : uploadedImage.row -->
Embedded Media The format for these Embedded Media fields is contained in "templateCell default.embeddedMedia", located in templates/common/embeddedMedia.html. [ learn more... ] Server Side Includes (SSI)While not actually unique to our Template System, we've included Server Side Includes (or SSI's) in our documentation because our templates often use them as a way of simplifying the content.SSI's are special tags used to pull the contents of another file into a page. Rather than have the same code on every single page for common elements like navigation or your page footer, you can use SSI on every page to pull in the code from a single file. Modifying the one file will affect all the pages that use SSI to include that file. The most common SSI's are "virtual" and "file", which look like this: <!--#include virtual="/dir/file.ext" --> <!--#include file="subdir/file.ext" --> [ learn more... ] Placeholder ModifiersPlaceholders can have special suffixes attached to them called Placeholder Modifiers.Placeholder Modifiers alter the content that's displayed for that Placeholder. They can be used to change the format of a date field, convert the content for use in JavaScript or URL's, and much more. Here are some sample modifiers. As you can see, they are added to the end of the Placeholder, separated by a colon. Example: The table below shows how different modifiers convert the same placeholder's content.
[ learn more... ] |