Re: [SMARTY] {literal}{/literal} and {ldelim}{rdelim}
| From: | Matthias Mohr | Date: | Tue, 15 Apr 2003 07:39:55 +0000 |
| Subject: | Re: [SMARTY] {literal}{/literal} and {ldelim}{rdelim} | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9266@lists.php.net to get a copy of this message | ||
> When I include javascript codes into my template, since javascript function blocks have a
> single pair of { }, can I use {ldelim}
and {rdelim} in place of literals?
As you mentioned in your subject, you can use {literal] / {/literal} to make a block around your
javascript which smarty does not
"see".
Or you can change the delimiters to be something else and not {}.
But with {ldelim} and {rdelim} you can only view the current delimiters inside a template.
You have to change the delimiter-settings from PHP like that:
--------------------------------------------------------------------------------------------------------------
require_once( 'Smarty.class.php' );
$smarty = &new Smarty();
$smarty->left_delimiter = '<{';
$smarty->right_delimiter = '}>';
--------------------------------------------------------------------------------------------------------------
Or you make your own Smarty-Class which extends the original one and sets
the delimiters in the constructor.
BTW, I find '<{' and '}>' a good alternative for the delimiters, because
they don't
interfere with javascript, look similar to the original delimiters and also look like
HTML-tags for graphical editors...
with regards,
Matthias