Providing resources for people with a passion for Christ and the web
Welcome!
[User Guides and Resource Library :: Themes and Templates :: Default Theme :: This page]  

Smarty Tags

Smarty

XOOPS uses the Smarty Template Engine and XOOPS themes have Smarty tags embedded in the HTML code. Smarty tags are identified by the delimiters <{ and }>. 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 XOOPS 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:

XOOPS Information

<{$xoops_version}> - XOOPS Version
<{$xoops_rootpath}> - path to XOOPS root
<{$xoops_upload_url}> - URL to XOOPS uploads directory
<{$xoops_url}> - URL to XOOPS root

New Variables

<{xoAppUrl /}> same as old $xoops_url

Site Information

<{$xoops_charset}> - Charset used on the page, e.g. ISO-8859-1
<{$xoops_langcode}> - language code used for page (e.g. en for English)
<{$xoops_sitename}> - Site Name
<{$xoops_slogan}> - Site Slogan

Meta tag information

<{$xoops_meta_keywords}> - Meta tag keywords
<{$xoops_meta_description}> - Meta tag site description
<{$xoops_meta_copyright}> - Meta tag copyright text
<{$xoops_meta_robots}> - Meta tag robot information
<{$xoops_meta_rating}> - Meta tag rating information
<{$xoops_meta_author}> - Meta tag author information
<{$xoops_footer}> - Site footer text

Theme Information

<{$xoops_theme}> - Name of theme folder
<{$xoops_themecss}> - URL to theme's css file
<{$xoops_imageurl}> - URL to theme folder

New Variables

<{xoImgUrl}> same as old $xoops_imageurl

User Information

<{$xoops_isuser}> - 1 if user is logged in, 0 if anonymous user
<{$xoops_uname}> - User name
<{$user_method}> - Logged in user's preferred notification method
<{$xoops_isadmin}> - 1 if admin, 0 if not (Admin rights to current module is the deciding factor)
<{$xoops_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

<{$xoBlocks.page_topleft}> - same as <{$xoops_clblocks}> - Array of top center-left blocks
<{$xoBlocks.page_topcenter}> - same as <{$xoops_ccblocks}> - Array of top center-center blocks
<{$xoBlocks.page_topright}> - same as <{$xoops_crblocks}> - Array of top center-right blocks
<{$xoBlocks.page_bottomleft}> - new block position - Array of bottom center-left blocks
<{$xoBlocks.page_bottomcenter}> - new block position - Array of bottom center-center blocks
<{$xoBlocks.page_bottomright}> - new block position - Array of bottom center-right blocks
<{$xoBlocks.canvas_left}> - same as <{$xoops_lblocks}> - An array of the left blocks
<{$xoBlocks.canvas_right}> - same as <{$xoops_rblocks}> - Array of right blocks

Page Information

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

Banner

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

Miscellaneous

<{$SCRIPT_NAME}> - path to file name requested from XOOPS root (e.g. modules/news/index.php)
<{$xoops_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 2007/7/30 by Steve
 

Bookmark and Share!

Join Us On Facebook

Find Us on the Socials

Facebook Christian Web Resources LinkedIn page YouTube