Re: [SMARTY] Custom plug in : completely confused....

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: [SMARTY] Custom plug in : completely confused....
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3683@lists.php.net to get a copy of this message
Hi! I tried to use your plugin, and it seems to work fine! WHat exactly is the problem you're having? This is what i did: Put the file in the plugindir. in my tpl, i write: {sniff_browser} {$browser.type} and i get 'Opera' on my page! I noticed though, that before I removedan error from the pluginfile (a comment had lined-wrapped) smarty just cut off output without any message. Not sure why. /l On Sat, 13 Apr 2002 22:31:35 +0200 Luc Saint-Elie <luc@saint-elie.com> wrote: > hello, > > As stated in a previous mail, I'm trying to understand how to write a > plug in. > > I'm trying withe very simple one that is supposed to assign to $smarty > an > array containing various client informations (browser type, operating > system...) very basic stuff > > I'm reading every bit of the doc but they are VERY confusing. > For exemple at : > > http://www.phpinsider.com/php/code/Smarty/docs/plugins.functions.htmlge|$˜ú:Û~NYK: > ˆú > > There is an example of a custom function without output > (what I want to do) but this function is called : > function.assign.php > > So I'm wondering if > $smarty->assign($var, $value); > is a call to this custom function of the usual > $smarty->assign('me', 'Luc); > > And so on.... > > My question : > > 1 The plug in function > ================= > It has to return and array.. how does this function end? > > The function is named > smarty_function_sniff_browser($params, &$smarty) > { > ....... > } > if it was a classical function it would ends by > return $browser; > > $browser is an array ( > 'type' => > 'version' => > 'platform' => > 'css' => > 'dom' => > ); > > what is the ending for a Smarty plug-in > How to send the resulting array to Smarty ??????? > > 2 the template(*.tpl) file > =================== > > How to I call the array ? > > Thanks in advance > > Luc > >

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