Tag Archives: smarty

Iterate Array contents in Smarty templates

Description: Iterate an Array passed as a variable in a Smarty template Solution: The equivalent of foreach() clause in PHP translates as section in Smarty templates, as following: {section name=arrayID loop=$theArray}     <input type=checkbox” name=”{$theArray[arrayID ]}” {/section} The code above … Continue reading

Posted in PhP | Tagged , | Leave a comment

Smarty Server environment variables

Description: How to echo server environment variables in Smarty templates, such as HTTP_HOST Solution: You can access $_SERVER variables through $smarty.server : <p>{$smarty.server.SERVER_NAME}</p>

Posted in PhP, Script | Tagged , | Leave a comment