Re: [SMARTY] Smarty and ZopePageTemplates
| From: | Andreas Kossmeier | Date: | Wed, 19 Jun 2002 19:01:30 +0000 |
| Subject: | Re: [SMARTY] Smarty and ZopePageTemplates | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4951@lists.php.net to get a copy of this message | ||
james nguyen wrote:
it's pretty easy to implement actually. i'll give you the prefilter i use to allow for inline tags to work without having to use the main delimiters like <smarty: />. here's the code for a prefilter to use:you can use prefilters for various powerful tasks, one of these is altering the template syntax. here is another easy one: <smarty:foreach from=$contacts item="contact"> <smarty:if $contact.id eq 10>
{$contact.id} - {$contact.name}<br>
</smarty:if>
</smarty:foreach>
prefilter:
------------------
/**
* smarty prefilter for xhtml "like" control structures
*
* @author <andreas.kossmeier@bergfex.at>
* @version
* @copyright bergfex.at - Kuemmel, Kossmeier & Jusinger OEG 2002
*/
function smarty_prefilter_smarty($src, &$smarty)
{
$leftDelim = $smarty->left_delimiter;
$rightDelim = $smarty->right_delimiter;
$prefix = 'smarty';
return preg_replace("/<(\/?)$prefix:(.+?)>/",
"$leftDelim\\1\\2$rightDelim",
$src);
}
------------------
andreas
--
andreas kossmeier
bergfex.at - http://www.bergfex.at