ImpressCMS proudly uses SourceForge
ImpressCMS on Ohloh.net
[Third Party Libraries :: This page]  
Tags: Theme   Template   Smarty   Smarty Tag  

Smarty

ImpressCMS uses the Smarty Template Engine and ImpressCMS themes have Smarty tags embedded in the HTML code.

Smarty tags are identified by the delimiters. ImpressCMS makes use of <{ and }> as the delimiters, not the default { and } of Smarty. The use of Smarty also allows you to embed PHP code into your theme and make use of control structures (if, foreach, include) within your HTML.

The core provides you with some of the smarty variables available to use in your theme and the modules you use may also provide some additional variables. Here are some useful smarty variables:

ImpressCMS Information

<{$icms_version}> - ImpressCMS Version
<{$icms_rootpath}>- path to ImpressCMS root
<{$icms_upload_url}>- URL to ImpressCMS uploads directory
<{$icms_url}>- URL to ImpressCMS root, same as old $xoops_url

Site Information

<{$icms_charset}> - Charset used on the page, e.g. ISO-8859-1
<{$icms_langcode}> - language code used for page (e.g. en for English)
<{$icms_sitename}> - Site Name
<{$icms_slogan}> - Site Slogan

Meta tag information

<{$icms_meta_keywords}> - Meta tag keywords
<{$icms_meta_description}> - Meta tag site description
<{$icms_meta_copyright}> - Meta tag copyright text
<{$icms_meta_robots}> - Meta tag robot information
<{$icms_meta_rating}> - Meta tag rating information
<{$icms_meta_author}> - Meta tag author information
<{$icms_footer}> - Site footer text

Theme Information

<{$icms_theme}> - Name of theme folder
<{$icms_themecss}> - URL to theme's css file (function xoops_getcss() returns a value based on the HTTP_USER_AGENT)
<{$icms_imageurl}> - URL to theme folder, same as old $xoops_imageurl

User Information

<{$icms_isuser}> - 1 if user is logged in, 0 if anonymous user
<{$icms_uname}> - User name
<{$icms_method}> - Logged in user's preferred notification method
<{$icms_isadmin}> - 1 if admin, 0 if not (Admin rights to current module is the deciding factor)
<{$icms_userid}> - User's ID

Blocks

only available if block contains content

<{$xoops_lblocks}> - An array of the left blocks
<{$block.title}> - Title Of The Block Thats In The $xoops_??blocks array
<{$block.content}> - content displayed by the block
<{$xoops_showcblock}> If True, Shows Center Blocks ex: <{if $xoops_showcblock == 1}> center block's loop <{/if}>
<{$xoops_clblocks}> - Array of center-left blocks
<{$xoops_ccblocks}> - Array of center-center blocks
<{$xoops_crblocks}> - Array of center-right blocks
<{$xoops_showrblock}> - If True Shows Right Blocks ex: <{if $xoops_showrblock == 1}> right block's loop <{/if}>
<{$xoops_rblocks}> - Array of right blocks

New variables

- same as - Array of top center-left blocks
- same as - Array of top center-center blocks
- same as - Array of top center-right blocks
- new block position - Array of bottom center-left blocks
- new block position - Array of bottom center-center blocks
- new block position - Array of bottom center-right blocks
- same as - An array of the left blocks
- same as - Array of right blocks

Page Information

<{$icms_pagetitle}> - Page title, often assigned by the currently viewed module so that it reflects the page content.
<{$icms_contents}> - The content of the page
<{$icms_dirname}> - The name of the current module directory. If no module is being displayed, this = "system"

Banner

<{$icms_banner}> - Retrieves the banner from System Admin > Banners

Miscellaneous

<{$SCRIPT_NAME}> - path to file name requested from the stie root (e.g. modules/news/index.php)
<{$icms_requesturi}> - requested url (e.g. /modules/news/article.php?storyid=1)

Control Structures

<{php}>
     php code;
<{/php}>

<{if ''condition''}>
     what to do
<{elseif ''another condition''}>
     something to do if first condition is false and this condition is true
<{else}>
     something to if first condition is false and second condition is false
<{/if}>

<{foreach item=''key'' from=''array''}>
     what to do
<{/foreach}>

<{include file="path/file.ext"}>

Last modified on 2012/5/10 by skenow
This page was created on 2010/11/11 by skenow
This page has been viewed 8398 time(s)

Comments
The comments are owned by the poster. We aren't responsible for their content.
ImpressCMS proudly uses SourceForge
ImpressCMS on Ohloh.net