COMMUNITY FORUM
Plugin Trigger just in k2 item page not category
- Kran Chi
- Topic Author
- Visitor
6 years 2 months ago #169253
by Kran Chi
Plugin Trigger just in k2 item page not category was created 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.
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
- Offline
- Platinum Member
- Joomla Developer
Less
More
6 years 2 months ago #169256
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
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:
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
- Topic Author
- Visitor
6 years 2 months ago #169259
by Kran Chi
Replied by Kran Chi on topic Plugin Trigger just in k2 item page not category
It's working. thank you
The topic has been locked.
- Kran Chi
- Topic Author
- Visitor
6 years 2 months ago #169263
by Kran Chi
Replied by Kran Chi on topic Plugin Trigger just in k2 item page not category
Sorry but this trick not working when SEO links in Joomla Configuration is on.
The topic has been locked.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
6 years 2 months ago #169267
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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
- Topic Author
- Visitor
6 years 2 months ago #169282
by Kran Chi
Replied by Kran Chi on topic Plugin Trigger just in k2 item page not category
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.
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
- Offline
- Platinum Member
- Joomla Developer
6 years 2 months ago #169287
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
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?
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
- Topic Author
- Visitor
6 years 1 month ago #169413
by Kran Chi
Replied by Kran Chi on topic Plugin Trigger just in k2 item page not category
yes,hopefully.
I added it to onK2BeforeDisplayContent
I added it to onK2BeforeDisplayContent
The topic has been locked.