|
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 |
Terry151151 Smarty Regular
Joined: 06 May 2010 Posts: 37 Location: Sydney Australia
|
Posted: Thu Jan 23, 2014 8:56 pm Post subject: Changing Smarty delimiters on the fly. |
|
|
As there seems to be only one set of possible left and right delimiters is it possible to change the delimiters on the fly?
What I want to do is change the delimiters to /*{ and }*/ inside JavaScript because I often append Smarty variables to function names and this messes up Dreamweaver's JavaScript syntaxing.
So I'd like make the variables to look like comments to Dreamweaver. I don't always want to change it to /*{ and }*/ as I would have hundreds of templates to change and would have to go back and test everything; BIG JOB.
What I'd like to be able to do is:
{JavaScript} // Delimiters change here to /*{ and }*/
...
function /*{FUNCTION_MOFIFIER}*/FunctionName()
{
}
...
...
{/JavaScript} // Delimiters revert back to { and }
Is this possible without messing up the template compiler?
Regards
Terry |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Jan 23, 2014 11:09 pm Post subject: |
|
|
Use whatever alternate syntax you want like /*{ }*/ then create a prefilter that searches and replaces the /*{ with { and }*/ with } just before compile time.
Last edited by mohrt on Fri Jan 24, 2014 3:22 am; edited 1 time in total |
|
Back to top |
|
Terry151151 Smarty Regular
Joined: 06 May 2010 Posts: 37 Location: Sydney Australia
|
Posted: Fri Jan 24, 2014 12:00 am Post subject: |
|
|
Thanks for the clue I think a pre-filter should work.
Regards
Terry |
|
Back to top |
|
Terry151151 Smarty Regular
Joined: 06 May 2010 Posts: 37 Location: Sydney Australia
|
Posted: Fri Jan 24, 2014 12:23 am Post subject: |
|
|
The the prefilter work great.
Thanks
Terry |
|
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
|