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

{insert} tags are deprecated from Smarty...

 
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
tporter
Smarty n00b


Joined: 17 Jun 2014
Posts: 2

PostPosted: Tue Jun 17, 2014 6:59 pm    Post subject: {insert} tags are deprecated from Smarty... Reply with quote

Greetings,

I'm working on moving some old code which has a lot of the {insert ... } type of plugins (ad banner, rss feed, etc ...

I was looking at the docs to see what had changed and there is a notice on http://www.smarty.net/docs/en/language.function.insert.tpl, that says "{insert} tags are deprecated from Smarty, and should not be used. Put your PHP logic in PHP scripts or plugin functions instead."

I'm guessing the "PHP script" means use an include (haven't tried this yet)... I did try "plugin functions", since i could just move the code from the insert plugin to the function plugin... but the results cached so not the same as the original insert.

So I was trying to figure out if there was a plugin function that replaced the insert's ability - "{insert} tags work much like {include} tags, except that {insert} tags are NOT cached when template caching is enabled. They will be executed on every invocation of the template. "

I found the another reference to the insert plugin at http://www.smarty.net/docs/en/plugins.inserts.tpl, but there is no deprecated notice on that page... so is {insert ... } deprecated or not?

And what is the recommended way to replace it with to get the similar functionality ?

Thanks for your time.
Terre
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Jun 17, 2014 7:25 pm    Post subject: Reply with quote

{insert} is still available with the SmartyBC class. See http://www.smarty.net/docs/en/bc.tpl

Also you can register a function as plugin which is not cached.
See http://www.smarty.net/docs/en/api.register.plugin.tpl
Back to top
View user's profile Send private message
tporter
Smarty n00b


Joined: 17 Jun 2014
Posts: 2

PostPosted: Tue Jun 17, 2014 7:43 pm    Post subject: Reply with quote

U.Tews wrote:
{insert} is still available with the SmartyBC class. See http://www.smarty.net/docs/en/bc.tpl

Also you can register a function as plugin which is not cached.
See http://www.smarty.net/docs/en/api.register.plugin.tpl


It appears the {insert} is working without the SmartyBC class... (at least so far)

I was using the auto-register aka putting the plugin file in the plugin's dir. I will check out the register and its cache option, it looks promising.

Thanks !
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