Keyword

Plugin Trigger just in k2 item page not category

  • Kran Chi
  • Kran Chi's Avatar Topic Author
  • Visitor
5 years 6 months ago #169253 by Kran Chi
Hello to all,

I saw the list of events in k2 but is there a special event that run just when a user watching the article page?
In fact I don't want my custom plugin runs in home page of site.

Thank you
with best.
The topic has been locked.
  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
5 years 6 months ago #169256 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Plugin Trigger just in k2 item page not category
Hi
You can restrict the plugin output to the article page using this if statement:
<?php
$jinput = JFactory::getApplication()->input;
$view = $jinput->get('view');
$option = $jinput->get('option');
if($option == 'com_k2'  && $view== 'item') {
    // Do the plugin work and return output
}

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
The topic has been locked.
  • Kran Chi
  • Kran Chi's Avatar Topic Author
  • Visitor
5 years 6 months ago #169259 by Kran Chi
It's working. thank you
The topic has been locked.
  • Kran Chi
  • Kran Chi's Avatar Topic Author
  • Visitor
5 years 6 months ago #169263 by Kran Chi
Sorry but this trick not working when SEO links in Joomla Configuration is on.
The topic has been locked.
More
5 years 6 months ago #169267 by JoomlaWorks
Replied by JoomlaWorks on topic Plugin Trigger just in k2 item page not category
The code Mohamed provided is correct. It works in any case, with or without SEF enabled.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
The topic has been locked.
  • Kran Chi
  • Kran Chi's Avatar Topic Author
  • Visitor
5 years 6 months ago #169282 by Kran Chi
No, it's not.
Just for the record this code not working in system plugin.
I changed the type to content and the problem fixed.
The topic has been locked.
  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
5 years 6 months ago #169287 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Plugin Trigger just in k2 item page not category
At least it works now :)
To which system event did you attach this code?

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
The topic has been locked.
  • Kran Chi
  • Kran Chi's Avatar Topic Author
  • Visitor
5 years 6 months ago #169413 by Kran Chi
yes,hopefully.
I added it to onK2BeforeDisplayContent
The topic has been locked.

Powered by Kunena Forum