Page 1 of 1
How tu execute plug-in in module...
Posted: Tue Oct 20, 2015 10:16 am
by pjanda79
Hello,
I've done plugin in plugins dir... and it works in templates correctly... But is there any chance to run my smarty_cms_function_something() in module? - for examle if I want tu run cms_version "tag" witch is plugin in php of module...
Thank you!
Re: How tu execute plug-in in module...
Posted: Wed Oct 21, 2015 5:53 pm
by Dr.CSS
If you look under extensions > plugins page then hit the name of the plugin they will tell you how to use it most times...
Re: How tu execute plug-in in module...
Posted: Thu Oct 22, 2015 5:33 am
by pjanda79
Yes, usually there is help for each plugin... But it shows smarty tag usage only... And I want to use plugin-function in module - it means in PHP code of any module... something like
Code: Select all
$class_name->cms_version($params,...);
Thank you. Pavel
Re: How tu execute plug-in in module...
Posted: Thu Oct 22, 2015 12:00 pm
by Jo Morg
pjanda79 wrote:And I want to use plugin-function in module
You can't, not like that. You may use smarty to evaluate a template, and for that you'd need to do something like:
Code: Select all
$result = $smarty->fetch('eval:{aSmartyTag}');
But it is slow and usually it should be avoided. Most of the time there are better ways to get what you want by using PHP: all plugins are made of PHP native code so you may be better off checking the source code and reproduce it... for instance: {cms_version} is just:
Code: Select all
global $CMS_VERSION;
return $CMS_VERSION;
... why would you need to call a smarty tag from PHP just for that?