|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Metzen Smarty Rookie
Joined: 16 Jan 2004 Posts: 6
|
Posted: Sat Mar 05, 2005 12:13 am Post subject: Idea for Multiple Delimiters (Easier JavaScript & CSS) |
|
|
{literal} tags work great usually, but when dynamically generating JavaScript or CSS code you find yourself in and out of literal mode about every other line.
So, here is my proposed solution:
Allow a secondary set of delimiters:
$smarty->left_delimiter = '{';
$smarty->right_delimiter = '}';
$smarty->left_delimiter_backup = '<!--{';
$smarty->right_delimiter_backup = '}-->';
Then when you are in JS or CSS code instead of surrounding it with {literal} and {/literal}, you surround it with {use_backup} and {/use_backup}, or whatever, which tells Smarty to ONLY parse the backup delimiters.
So you could use either set of delimiters anywhere in any of your templates, except in between {use_backup} and {/use_backup} where only the backup delimiters would be used.
Thoughts? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Mar 05, 2005 3:32 am Post subject: |
|
|
an easier method would be to write a prefilter that seeks out your javascript/css delimiters and replace them with {ldelim} {rdelim} just before compiling. Then there is no special syntax necessary in the template. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|