Re: [SMARTY] multiple delimiters

From: Date: Tue, 21 May 2002 23:02:54 +0000
Subject: Re: [SMARTY] multiple delimiters
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4344@lists.php.net to get a copy of this message
You can achieve that with an prefilter eg. put a file named "prefilter.convert_html_comment_smarty_tags.php" into the smarty plugin directory containing the following code <?php /* * Smarty plugin * ------------------------------------------------------------- */ function smarty_prefilter_convert_html_comment_smarty_tags($source, &$smarty) { $source = str_replace("<!--".$smarty->left_delimiter, $smarty->left_delimiter,$source); $source = str_replace($smarty->right_delimiter."-->", $smarty->right_delimiter,$source); return $source; } ?> now smarty tags can be enclosed in html comment tags. cu Manfred ----- Original Message ----- From: <msm@manley.org> To: <smarty-general@lists.php.net> Sent: Tuesday, May 21, 2002 6:49 PM Subject: [SMARTY] multiple delimiters In a number of lesser PHP template systems, and in non-PHP sytems like Perl's Template Toolkit (which is very much like Smarty otherwise) there's a nice feature that I don't see how to do in Smarty. The concept is that there are different but equivalent delimiters for template control structures and variable interpolation. For example: <!--{section name=customer loop=$custid }--> id: {$custid[customer]}<br> name: {$name[customer]}<br> address: {$address[customer]}<br> <p> <!--{/section }--> The idea is that anything that isn't meant to output text looks like an (X)HTML comment, and things that should output HTML look like placeholders. This makes for nice behavior in HTML editors and also when simply dropping a template into the browser to look at things. The problem with just using the comment syntax for everything is that when you preview a template in a browser during development, the page has blank spots where you'd rather get a look at placeholder values. This is especially true when previewing table rows, for example. I've taken a look through the Smarty source and don't easily see a way to do this. I'm also not certain what you would do for the {ldelim} and {rdelim} functions in the case of multiple delimiter choices. Any ideas? MSM -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#4344) next »