|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Acry Smarty n00b
Joined: 08 Sep 2003 Posts: 2
|
Posted: Mon Sep 08, 2003 9:16 pm Post subject: Custom functions ( plugins ) |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Sep 08, 2003 9:44 pm Post subject: |
|
|
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 |
|
|
|
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
|