|
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 |
kaas Smarty Rookie
Joined: 05 Feb 2009 Posts: 13
|
Posted: Wed Jun 24, 2009 10:36 am Post subject: appel d'une fonction plugin |
|
|
Bonjour,
comment je peux appeler une fonction de plugin qui prend deux arguments en entrée et renvoie une valeur ?
voici ma fonctrion
Code: |
<?php
function smarty_function_bashing($droit_predefini, $val_droit)
{
if ($droit_predefini & $val_droit)
{
$balise = "checked";
}
else
{
$balise = "";
}
return $balise;
}
?>
si toutes fois il y a des erreurs dans la manière d'écrire la fonction, je serais heureux de parvenir à un bon résultat avec vos idées.
Merci.
|
|
|
Back to top |
|
Gowser Smarty Pro
Joined: 19 Feb 2008 Posts: 104 Location: Nantes (France)
|
Posted: Thu Sep 10, 2009 2:15 pm Post subject: |
|
|
Bonjour,
Voici le source correcte pour votre fonction :
Code: |
function smarty_function_bashing($params, &$smarty){
$droit_predefini = $params['droit_predefini'];
$val_droit = $params['val_droit'];
if ($droit_predefini & $val_droit)
{
$balise = "checked";
}
else
{
$balise = "";
}
return $balise;
}
|
Pour l'appeler dans un tpl :
Code: | {bashing droit_predefini=true val_droit=true} |
Voilou, ++ |
|
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
|