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

Activer une fonction de plugin directement en PHP

 
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 -> Language: French
View previous topic :: View next topic  
Author Message
zorx
Smarty Rookie


Joined: 15 Aug 2011
Posts: 6

PostPosted: Mon Aug 15, 2011 3:05 pm    Post subject: Activer une fonction de plugin directement en PHP Reply with quote

Bonjour,

Je voudrai savoir si y a moyen d'activer un plugin directement via PHP exemple :

<?php

$smarty->registerPlugin("function","afficher", "afficher");
function afficher ($params, $smarty)
{
$msg='';
if (isset($params['msg']))
$msg = $params['msg'];

return $msg;
}

echo "{afficher msg='salutation'}";

?>

est-ce qu'il y a moyen que ça m'affiche le message "salutation" au lieu de "{afficher msg='salutation'}" ? avec smarty (sans passer par un template)

Cordialement
Back to top
View user's profile Send private message
zorx
Smarty Rookie


Joined: 15 Aug 2011
Posts: 6

PostPosted: Mon Aug 15, 2011 3:26 pm    Post subject: Reply with quote

c'est bon j'ai trouvé, pour ceux qui sont intéressés :

Code:
echo $smarty->fetch("string:{afficher msg='salutation'}");


ps: c'est pour smarty 3
Back to top
View user's profile Send private message
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 -> Language: French 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