Keyword

call variable from a plugin in k2 template

  • schlogo
  • schlogo's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 9 months ago #102740 by schlogo
Hello

I have a plugin question, i need to insert the following piece of code in a k2 template. The plugin works but the farm parameter not filled. It should ge its value from the $farm variable but i can't fix it . I ve tested the value of $farm before and after the plugin code, it has the good value.

So question is, what am i doing wrong ? Tks for your help !

Log in  or Create an account to join the conversation.

More
12 years 9 months ago #102741 by Lefteris
Replied by Lefteris on topic Re: call variable from a plugin in k2 template
Hi. In order to get the parameters of any Joomla! plugin you can use the following code:
$plugin = JPluginHelper::getPlugin('content', 'loadmodule');
$params = new JRegistry($plugin->params);

Note that this example takes the parameters of the Load Module content plugin. You should specify the name of the plugin you wish.

Please Log in or Create an account to join the conversation.

  • schlogo
  • schlogo's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 9 months ago #102742 by schlogo
Hello Lefteris

I am not too sure about your answer. Maybe i ve misguided you. I don't want to extact a variable from a plugin, i want to inject it in the plugin. Does that make sense ?

I want the plugin to use a k2 extra field as one of its variable

O

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #102743 by Lefteris
Replied by Lefteris on topic Re: call variable from a plugin in k2 template
Hi. What kind of plugin are you developing? If it's a K2 or content plugin the whole item is available in your function including the item extra fields.

Please Log in or Create an account to join the conversation.