CityDesk 2.0-Documentation
Using Template FamiliesOne of CityDesk's great features is that it can publish multiple copies of every article, using different formatting for each.
This is done using template families . A template family is a set containing one of each template in your site.
For example, imagine a news site with three templates: NewsStory, SportsScores, and WeatherReport. Each article is assigned to one of these templates which all look slightly different.
Now, imagine that you need two versions of your newspaper: a fancy HTML version, and a "text-only" version that eliminates fancy formatting. You could do this by creating two template families, called HTML and PlainText. An example of this appears at right.
Each template exists in every template family. In this example, you actually have to provide six templates.
By default, when you publish a site with multiple template families, CityDesk will create a subdirectory for each template family and put a complete copy of the site in each subdirectory, each formatted using the appropriate template family's templates. So when this site is published, you'll get two subdirectories, one called HTML and the other called PlainText. Each subdirectory will contain a complete copy of the site.
You can override this behavior by creating a custom Publish Location that only publishes a single template family. If the plain text version of your site lives on a different web server, this is especially convenient. See Managing Publish Locations.
CityDesk is not limited to basic HTML. It is also capable of outputting other HTML-like formats:
HTML Help files All types of XML files WML files- Microsoft Word for Windows (HTML file format)
- RSS Syndication Feeds
Some of these types expect different file extensions, for example, .xml for XML files. CityDesk lets you change the extension of any template independently, so, for example, the XML version of your site can output .xml files while the HTML version outputs .html files.
You can also output text files (.TXT) or other formats which are completely unrelated to HTML, with one caveat -- articles you create will contain some simple HTML tags like <p> to separate paragraphs.
To manipulate template families:
Make sure you are in Designer Mode
In the main window, choose View » Templates or click on the Templates tool:
TemplatesThe Templates Dialog will appear.
To add a template family:
Click New Family and provide a name for the template family.
To rename a template family:
Select the family and click Properties.
To delete a template family:
Select the family and click Delete.
When you are done, close the Templates Dialog by clicking Done.
You can automatically create a link from each article to a different template family version of that article by using the .abslink variable in your templates. For example, if you want to maintain a PrinterFriendly template family, each article can include a link to its PrinterFriendly version and vice-versa. Here's how to accomplish that:
Suppose you have a site with two template families (HTML, PrinterFriendly). There is one template called Simple. You have two publish locations: http://mysite.com for the normal version and http://mysite.com/printerFriendly for the printer friendly version.
In the HTML Simple template, add a link like this:
<a href="http://mysite.com/printerFriendly/{$.absLink$}">Printer Friendly Version</a>
In the PrinterFriendly Simple template, add a link like this:
<a href="http://mysite.com/{$.absLink$}">Normal Version</a>
Notice the use of .absLink which returns a link to the article that includes the full folder path. For example for an article in the news/articles/today folder named MyItem, .abslink would return news/articles/today/MyItem.html.
©Copyright 2001-2003 Fog Creek Software, Inc. All Rights Reserved.