- Posts: 13
COMMUNITY FORUM
Joomla Plugin output in K2 Plugin
- Keeper91
- Topic Author
- Offline
- New Member
Less
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?
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.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
12 years 5 months ago #67331
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 13
12 years 5 months ago #67332
by Keeper91
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:
In my case with the Jant Gallery:
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 13
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:
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.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
12 years 5 months ago #67334
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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)
{ }
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 13
12 years 5 months ago #67335
by Keeper91
Yeah!! That did it!! :woohoo:
Lefteris you rock! :P Thank you very much
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.