Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
My javascript/CSS curly braces are creating errors

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> FAQ (Frequently Asked Questions)
View previous topic :: View next topic  
Author Message
mohrt
Administrator


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

PostPosted: Thu Feb 03, 2005 4:09 pm    Post subject: My javascript/CSS curly braces are creating errors Reply with quote

Curly braces {} are the default delimiters in Smarty. If you don't want curly braces interpreted as Smarty tags, you must enclose them in {literal}{/literal} tags. Example:

Code:
{literal}
   <script language="javascript">
   <!--
   function getPrompt() {
      // js function here
   }
   //-->
   </script>
{/literal}


You can also use {ldelim}{rdelim} tags in place of the curly braces themselves. This is useful if you need working Smarty tags within the escaped braces. Example:

Code:
<script language="javascript">
   <!--
   function getPrompt() {ldelim}
      // js function here
   {rdelim}
   //-->
</script>


Note: Smarty 3 no longer requires literal tags as long as the braces are surrounded by white space.

See the documentation for more information:

http://www.smarty.net/docs/en/language.function.literal.tpl
http://www.smarty.net/docs/en/language.function.ldelim.tpl
http://www.smarty.net/docs/en/language.modifier.escape.tpl
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> FAQ (Frequently Asked Questions) All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can 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