Keyword

Joomla Plugin output in K2 Plugin

  • Keeper91
  • Keeper91's Avatar Topic Author
  • Offline
  • New Member
More
12 years 5 months ago #67330 by Keeper91
Joomla Plugin output in K2 Plugin was created by Keeper91
I created a simple K2 Plugin starting from the Exmaple K2 Plugin for Developers. This plugin just take a text input and output it in the frontend. My idea was to include in the input a code for a Joomla Plugin, in this case, Jant Image Gallery, so that it would be shown in the frontend, but it doesnt work.

When I write "{jant_lightgallery path=xxx/} " in the K2 Plugin textfield I created, it shows in the frontend only the code, but not the gallery. The same code works for the Article Content and even for the Extra Fields.

What should I do in order to make it work also in a K2 plugin?

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

More
12 years 5 months ago #67331 by Lefteris
Replied by Lefteris on topic Re: Joomla Plugin output in K2 Plugin
Hi. This has to do with your plugin. You need to call the plugin you want using Joomla! API.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Keeper91
  • Keeper91's Avatar Topic Author
  • Offline
  • New Member
More
12 years 5 months ago #67332 by Keeper91
Replied by Keeper91 on topic Re: Joomla Plugin output in K2 Plugin

Lefteris Kavadas wrote: Hi. This has to do with your plugin. You need to call the plugin you want using Joomla! API.


I found the solution! Thank you very much Lefteris.
I just had to add this code in the php file of the k2 plugin, in order to prepare the output of the plugin for joomla content plugins:
JHTML::_('content.prepare', $output);

In my case with the Jant Gallery:
$output = '{jant_lightgallery path='.$mygalleryPath.' /}';

return JHTML::_('content.prepare', $output);

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

  • Keeper91
  • Keeper91's Avatar Topic Author
  • Offline
  • New Member
More
12 years 5 months ago #67333 by Keeper91
Replied by Keeper91 on topic Re: Joomla Plugin output in K2 Plugin
I have a new problem.
My k2 plugin output is not only showing in the Item View but in the Category View too. I dont understand why cause in the code I only have statements for the output in Items:
Log in  or Create an account to join the conversation.

More
12 years 5 months ago #67334 by Lefteris
Replied by Lefteris on topic Re: Joomla Plugin output in K2 Plugin
Your plugin needs to check what the context is. Something like that will do the trick:

if(JRequest::getCmd('view') == 'item' && JRequest::getInt('id') == $item->id)
{ }

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Keeper91
  • Keeper91's Avatar Topic Author
  • Offline
  • New Member
More
12 years 5 months ago #67335 by Keeper91
Replied by Keeper91 on topic Re: Joomla Plugin output in K2 Plugin

Lefteris Kavadas wrote: Your plugin needs to check what the context is. Something like that will do the trick:

if(JRequest::getCmd('view') == 'item' && JRequest::getInt('id') == $item->id)
{ }


Yeah!! That did it!! :woohoo:
Lefteris you rock! :P Thank you very much

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