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

Function plugin, and nocache

 
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 -> Plugins
View previous topic :: View next topic  
Author Message
martyf
Smarty Rookie


Joined: 20 Oct 2010
Posts: 13

PostPosted: Thu Dec 02, 2010 7:59 am    Post subject: Function plugin, and nocache Reply with quote

Excuse me if this is a really noob question, but I've just started writing plugins for Smarty 3.

I've written functions, and everything works a treat.

I was then looking for a way to make a function call not be cached (i.e. run as an insert, not an include).

I saw lots of posts about using {nocache}...{/nocache} but thought that seemed a little over the top... I recalled seeing somewhere someone use a function call like:
{helloWorld nocache}

So I thought I'd give it a go - create a simple HelloWorld function that outputs the current time.

Running two calls - one with "nocache" and one without, it behaves as expected - the one without "nocache" is cached.

So - my question is - am I missing something obvious about using "nocache" in this way (is it bad or not recommended something)?
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Dec 02, 2010 5:39 pm    Post subject: Reply with quote

It's save to use {helloWorld nocache}.

This new option is not yet in documentation.
Back to top
View user's profile Send private message
martyf
Smarty Rookie


Joined: 20 Oct 2010
Posts: 13

PostPosted: Thu Dec 02, 2010 9:14 pm    Post subject: Reply with quote

Fantastic - thanks for the clarification Very Happy
Back to top
View user's profile Send private message
tron2k
Guest





PostPosted: Thu Dec 02, 2010 11:50 pm    Post subject: Reply with quote

U.Tews wrote:
It's save to use {helloWorld nocache}.

This new option is not yet in documentation.


hehe i just wanted to note that $smarty->assign("var",$value,true) wouldnt be in the docs, or that the nocache flags are missing in the cache section of the docs but that was all added today or so?

Good work! Thanks for all the effort you guys put into our most loved template engine.
Back to top
U.Tews
Administrator


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

PostPosted: Fri Dec 03, 2010 12:01 am    Post subject: Reply with quote

Yes, we are still extending and improving documentation.....
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 -> Plugins 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