|
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 |
smartybug Smarty Rookie
Joined: 18 Jan 2010 Posts: 14
|
Posted: Thu Apr 07, 2016 9:01 am Post subject: smarty php : how to pass variable in registerPlugin function |
|
|
i want to know how can i pass variable to function which am registering as plugin with registerPlugin() function of smarty php
how am doing.
i have smarty_get_data function
Code: |
function smarty_get_data($params, Smarty_Internal_Template $template)
{
// trying to use passed variable
echo 'passed var :: '.$params['doma'];
} |
variable which i want to pass
Code: | $doma = 'test var'; |
register as plug-in
Code: |
$smarty->registerPlugin('function', 'get_data', 'smarty_get_data', false, array('doma' => $doma)); |
output is blank
so need help what am doing wrong ! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Apr 07, 2016 1:14 pm Post subject: |
|
|
I don't know what you are doing wrong, because you are missing a lot in your post.
Where you are using your function? You are not invoking a template anywhere. |
|
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
|