Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
How to use Javascript codes in template files?
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7267
Location: Lincoln Nebraska, USA

PostPosted: Wed Dec 05, 2012 2:38 pm    Post subject: Re: What are the best delimeters then? Reply with quote

Juggler wrote:
What are the best delimeters then?

What I've seen
{{ }}
{# #}
<{ }>

Obviously to hide them from html developers/designers and not interfere with javascript?


The best delimiters are { }

Use Smarty 3 and put whitespace around them, and Smarty 3 ignores them.

Code:
<script>
function foo {  // smarty ignores this
    return;
} // this too
</script>
Back to top
View user's profile Send private message Visit poster's website
Aristophan
Smarty Regular


Joined: 10 Jan 2011
Posts: 84

PostPosted: Fri Dec 07, 2012 3:20 pm    Post subject: Reply with quote

Mohrt, what about ending javascript delimiters with }; ?
Must that be ' };' or ' } ;' or ' }; ' to get ignored?
I always took the last and that seems to work, but I would like to know exactly.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7267
Location: Lincoln Nebraska, USA

PostPosted: Fri Dec 07, 2012 3:24 pm    Post subject: Reply with quote

" } ;" would get ignored.

[edit] double check with Uwe, but }; might get ignored to, or }[anything]. you can test in a template and see what you get as well.
Back to top
View user's profile Send private message Visit poster's website
Aristophan
Smarty Regular


Joined: 10 Jan 2011
Posts: 84

PostPosted: Fri Dec 07, 2012 4:35 pm    Post subject: Reply with quote

" } ;" and " };" both work fine. (...did not check for anything Wink )
edit: - and even "};" does!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
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
Protected by Anti-Spam ACP