WSN Knowledge Base
Featuresspacer Showcasespacer Reviewsspacer Demosspacer Purchasespacer Manualspacer Support
Introduction to Template Variables
Introduction to Template Variables
By Paul

A template variable is an item you find in a template which will not be displayed to the user looking like it does in the template. Instead, these variables are replaced with appropriate HTML at the time the page is viewed according to the particular contents of the page. Rather than writing a separate page for each category, as you would with HTML, in these templates you can use {CATNAME} and it will automatically be replaced with the appropriate category name when the visitor views it.

Template variables come in types according to what areas they are associated with. Member variables carry information about who is viewing the page. Article variables carry information about a particular article. Category variables carry info about a particular category, and comment variables about a particular comment. Naturally, these variables can only be used in areas where they make sense. A comment variable on a category page will not work, for example, since there's no way to guess which comment it is intended to be.

When ever you add a new field to an area, it then becomes a variable for it's associate area. So the variables listed in this area of the manual may not be a complete list of variables for your individual use.

A few variables are external to this scheme and can be used anywhere... these are discussed in the 'global template variables' entry.

There are a couple of special categories of template variables:
1) Booleans. When you're writing a template conditional and want to test whether something exists, add BOOL to the end of your regular template variable. If you want to check the article field fieldname, for example, use {ARTICLEFIELDNAMEBOOL}. For another example, <IF {CATDESCRIPTIONBOOL}> will test for the existence of a category description.
2) Currency. When your field represents a currency value, displaying it as a plain number isn't always desirable. For example, instead of $2.50 it would show 2.5. You can append CURRENCY to get it formatted properly. For exmaple, if you want to display the article field price, use {ARTICLEPRICECURRENCY}.

Rating:


5/5 based on 1 vote. The median rating is 5.

Submitted: 09/25/03 (Edited 09/13/07)

Description: Learn the basics of these markers which stand in for dynamic information.

Views: 1923 views. Averaging 1 per day.
In the most recent 30 day period, there've been 3 views.

Previous Article


Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support