Re: new Smarty 2.0 plugin: calendar navigation widget

From: Date: Fri, 08 Mar 2002 07:11:01 +0000
Subject: Re: new Smarty 2.0 plugin: calendar navigation widget
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2974@lists.php.net to get a copy of this message
Excellent! I see a potential problem though; the smarty object is passed by reference into the function, and you are creating a new instance, overwriting the already existing one. This could have very disasterous results! It might be more efficient to use the existing $smarty object, but then you might run into variable assignment conflicts. so at least use a different name: $smarty_cal = new Smarty; and be sure you are using the same template directory, not just the default one out of Smarty.class.php! $smarty_cal->template_dir = $smarty->template_dir; then continue as normal: $smarty_cal->assign("url_format", $url_format); $smarty_cal->assign("month_name", $month_name); .... There are probably some other things I'm not thinking of, but this should help. Monte Michael Yoon wrote: > I just wrote a Smarty 2.0 plugin that outputs a calendar navigation > widget, and I thought that other people might find it useful. If you're > interested, check it out at: > > http://michael.yoon.org/software/smarty-plugins/ > > One nice aspect is that the plugin has its own template and stylesheet, > so changing layout and styling is easy to do. > > Also, I'm pretty new to Smarty (a great piece of software, by the way), > so any feedback on the code itself is welcome. > > -- Michael > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/

« previous php.smarty.general (#2974) next »