{Smart Tags}
A handy feature of Vanilla is the ability to place 'smart tags' within your page. A smart tag is simply a placeholder for other preset data. For example, when editing a page, I could enter the smart tag {TITLE}. When the published page is displayed, this placeholder is replaced by the page's title. It's a great way of accessing predefined words, phrases, numbers, images or mark-up etc.
Important - Smart Tags must contain UPPER_CASE letters with no spaces!
To insert a smart tag, you enter the variable you wish to output within curly brackets and tick the 'Allow Smart Tags in this page?' box in the page options. Smart tags can also be entered when editing in source mode.
Available Page Smart Tags
Scope: These smart tags only output the variables for the page they're in.
{PID}{PARENTID){TITLE){FRIENDLY_TITLE){META_DESCRIPTION){META_KEYWORDS){CONTENT)*{ISPHP){TAGS){LAST_UPDATED){USE_CUSTOM_HEADER){CUSTOM_HEADER_IMAGE){USE_CUSTOM_CSS){CUSTOM_CSS_FILE){USE_CUSTOM_HTML){CUSTOM_HTML_FILE){MENU_ITEM){MENU_ONLY){MENU_URL){SHOW_TOPLINK){SHOW_TOC){ALLOW_SMART_TAGS}{UNLINK_BREADCRUMB)
Available Site Smart Tags
Scope: These are global smart tags - usable within any page. There's an automatic smart tag for every configuration variable. Here's a more complete list of system variables.
{CONFIG_SITE_TITLE}{CONFIG_SITE_EMAIL}{CONFIG_SITE_URL}{CONFIG_DEFAULT_META_DESCRIPTION}{CONFIG_DEFAULT_META_KEYWORDS}{CONFIG_CONTENT_FOLDER}{CONFIG_HOMEPAGE_ID}{CONFIG_SITE_FOOTER}{CONFIG_LOGO_POSITION}{CONFIG_PAGE_NOT_FOUND_ID}{CONFIG_CSS_FILE}{CONFIG_RSS_LOCATION}{CONFIG_MAINTENANCE_ON}{CONFIG_MAINTENANCE_MESSAGE}
Caveats
If you allow a page to contain smart tags and enter one that doesn't exist, the page will throw an error. When smart tags are enabled, the curly brackets become reserved and anything within them will be considered a variable. And if it's not, it breaks.
Smart tags are not available within sidebars, custom HTML pages or pages that only contain raw PHP. If you wish to access variables within these pages, you must use PHP's echo or print function and use a dollar sign $ to declare the variable (note there is no dollar sign in front of smart tag variables).
* - Although the smart tag exists in theory, you cannot use {CONTENT} - this would send the system into an infinite loop whereby it would parse the content tag, find the content smart tag, parse that, find it again, and so on.
Extending with Custom Smart Tags
To extend the number of variables available within smart tags, you can add custom ones via the administration index (Super Admins only). Smart tags created this way are accessible from any page - i.e., they're considered global. For example, if I wanted to add a smart tag called 'TELEPHONE' - I'd enter the smart tag name (telephone) and a corresponding value (e.g., 123456) and this would then be accessible from any page by simply entering {TELEPHONE}. Smart tag names must only contain letters, numbers and underscores and you must use upper case when calling them. The actual smart tag value can be anything - even HTML and images.
Confused?
Basically there are three types of page that Vanilla can be set up to use (on a per-page basis):
- Normal - entered into the WYSIWYG editor - PHP is not allowed anywhere in these pages, smart tags are.
- PHP-enabled - can contain PHP, no smart tag support, variables must be output using print or echo.
- Custom - substitute your page for an external (uploaded) one. Again, no smart tags, but you can echo or print page and site variables (including what you enter into the WYSIWYG area).

