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

smarty php : how to pass variable in registerPlugin function

 
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 -> Plugins
View previous topic :: View next topic  
Author Message
smartybug
Smarty Rookie


Joined: 18 Jan 2010
Posts: 14

PostPosted: Thu Apr 07, 2016 9:01 am    Post subject: smarty php : how to pass variable in registerPlugin function Reply with quote

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
Quote:

passed var ::

so need help what am doing wrong !
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Apr 07, 2016 1:14 pm    Post subject: Reply with quote

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
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 -> Plugins 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