Re: [SMARTY] Smarty and ZopePageTemplates
| From: | Monte Ohrt | Date: | Wed, 19 Jun 2002 18:55:29 +0000 |
| Subject: | Re: [SMARTY] Smarty and ZopePageTemplates | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4950@lists.php.net to get a copy of this message | ||
That won't work in all cases, just blindly replacing ']' with '}'. What if ']' is part of the content?
You should use a regular expression, something that only replaces ']' that follows the opening '[dts:' tag, and even then it isn't foolproof. Maybe a multi-pass parser... this all sounds too familiar :-)
Monte
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: <?php /* * Smarty plugin * filename: prefilter.inline_tags.php * ------------------------------------------------------------- * used for inline tag attributes in order to build xml * compliant templates. */ function smarty_prefilter_inline_tags($source, &$smarty) {-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.$source = str_replace('[dts:', $smarty->left_delimiter, $source); $source = str_replace(']', $smarty->right_delimiter, $source); return $source;} ?> use this prefilter to allow for inline tag attributes to be used. in your example, you would use 'tal:' for the left delimiter and i guess '"' ends the attribute, so that can be the right delimiter. after that, you can regisister content as a function in smarty and pass it arguements as you wish. if you have further questions, let me know. -jamesFrom: Andres Ferrando <anferr@mecon.gov.ar> To: "james nguyen" <sentinael@hotmail.com> Subject: Re: [SMARTY] Smarty and ZopePageTemplates Date: Wed, 19 Jun 2002 15:06:03 -0300 Hi, james! I'm really interested on this solution!!! could you tell me more, or send me anything, please? thanks in advance!i've actually worked out a solution provided my a member on thislist thatallows me to create xhtml templates fine. i have tags such as <dts:BLOCKS side="right" /> and even inline tag attributes such as <body background="[dts:$THEMEPATH]/images/background.jpg"> my site can be found at www.duskyblue.net if you have any questions.i'vebeen trying to find out this solution forever to incorporate into the postnuke project. surprised that no one has done this before, or iftheyhave they just kept it to themselves. hope to hear from you. ;) -james-- Andres Ferrando <anferr@mecon.gov.ar>James Nguyen I/T Professional 600 Anton Boulevard 3rd Floor Costa Mesa, Ca 92626 "The philosophers have only interpreted the world in various was; the point is to change it."-Karl Marx_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.