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

Custom functions ( plugins )

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


Joined: 08 Sep 2003
Posts: 2

PostPosted: Mon Sep 08, 2003 9:16 pm    Post subject: Custom functions ( plugins ) Reply with quote

Hi,

is there any other way to access a custom function's parameters than using extract? can't i just do this : {function($variable1,$variable2)} ?

this is what i'm trying to do :

i have a section loop, and an array. i need to know the rating for every element in the array so i wrote a custom function smarty_function_showRating .

right now it doesn't work, i tried this :

[php:1:ec7cbb47d7]
extract ( $parameters );
if ( !empty ( $memberRating[i] ) ) {
$rating = $memberRating[i];
}
if ( !$rating ) {
$rating = 0;
}
[/php:1:ec7cbb47d7]

Please provide a solution, thank you
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Sep 08, 2003 9:44 pm    Post subject: Reply with quote

you can do everything with your $params that you can do with a hash-array in php. and that's a lot.

for example:
$list = array_values($params);
/* access $list[0] for the first param supplied, $list[1] for second... */

you'll always have to supply it as name=value-pairs
( {function ignored_name1=foo ignored_name2=bar ...} )
in the templates, though.

HTH
messju

[EDIT: it seems i cannot follow the second part of your question, sorry]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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