Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

What is the -{ for

 
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 -> General
View previous topic :: View next topic  
Author Message
durangod
Smarty Regular


Joined: 10 Feb 2011
Posts: 39

PostPosted: Sat Mar 12, 2016 6:39 am    Post subject: What is the -{ for Reply with quote

Hi,

I normally work on older versions of smarty but today i ran across something i had not seen before.

While working on a tpl file i found an if statment that was wrapped with the - sign.

Example: -{if whatever == 1}-
do something
-{/if}-

upon investigation i discovered that the - sign was preventing the code from being parsed to the page upon execution. With the - it was not present on page and ran just fine.

I have never seen this before, is this something new to smarty? Is this a custom engine based on smarty?

Anyone ever seen this and can explain this to me, thanks...

Smile
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Sat Mar 12, 2016 9:42 am    Post subject: Reply with quote

No, it's available for a long time Wink.

You can define the delimiters like you want. Default is {...}.

But the brackets are used too by JavaScript, CSS and so on.

So you can define other delimiters and Smarty will running without any problems.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sat Mar 12, 2016 7:08 pm    Post subject: Reply with quote

Custom delimiters were a Smarty feature for a long time. Longer than I can remember.
This may be useful, if you need to process template through two engines (i.e. a secure and insecure templating instances, or a template engine that itself generate templates for later execution by an actual webserver).
Back to top
View user's profile Send private message
durangod
Smarty Regular


Joined: 10 Feb 2011
Posts: 39

PostPosted: Wed Mar 16, 2016 10:58 am    Post subject: Reply with quote

Hi thank you both, yes i have seen and used the {} myself in coding just never saw a custom delimeter like that lol..

Sorry for the late "thank you" i have been sick for a few days.

Appreciate the info i will use that more often Smile
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Wed Mar 16, 2016 12:24 pm    Post subject: Reply with quote

To complete the informations Wink

http://www.smarty.net/docs/en/language.escaping.tpl
Back to top
View user's profile Send private message
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 -> General All times are GMT
Page 1 of 1

 
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