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 to go into an {if} tag

 
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
screenmates
Smarty Rookie


Joined: 04 Oct 2006
Posts: 14

PostPosted: Mon Jun 25, 2007 10:40 am    Post subject: Function to go into an {if} tag Reply with quote

Hi All,

I have to write a tag {cache id=...} that needs to be called in a if-statement inside templates, like so:

if ( ! cache->start())
{
// output content to cache...
$cache->end();
}
// output not cached...


I wrote the cache() and endcache() functions and registered them with smarty. But how do I include them in a if-tag, like so?

{if ! cache id=abc}
// output content to cache...
{endcache}
{/if}


The above does not work and gives an error:

Error: 256
Text : Smarty error: [in Header.tpl line 1]: syntax error: unidentified token '=' (Smarty_Compiler.class.php, line 1391)
File : \Library\Smarty\Smarty.class.php
Line : 1095

Is there anyother way I can include my function in a if-statement tag as mentioned above? I'm afraid I'm missing something terribly simple Sad

TIA
Back to top
View user's profile Send private message
screenmates
Smarty Rookie


Joined: 04 Oct 2006
Posts: 14

PostPosted: Mon Jun 25, 2007 11:17 am    Post subject: Reply with quote

Never mind; I figured it out.
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