- Posts: 12
COMMUNITY FORUM
[SOLVED] Plugins in generic.php
- Mihail Semerdzhiev
- Topic Author
- Offline
- New Member
Less
More
14 years 2 months ago #86629
by Mihail Semerdzhiev
[SOLVED] Plugins in generic.php was created by Mihail Semerdzhiev
Hi,how to load plugins in generic.php (tag listing view). I get the code for loading plugins from item.php:<!-- K2 Plugins: K2AfterDisplayTitle --> <?php echo $this->item->event->K2AfterDisplayTitle; ?> <!-- Plugins: AfterDisplayTitle --> <?php echo $this->item->event->AfterDisplayTitle; ?>but still i can't get the plugins in tag listings :(Can anyone help?
Please Log in or Create an account to join the conversation.
- Jiliko.net
- Offline
- Platinum Member
Less
More
- Posts: 567
14 years 2 months ago #86630
by Jiliko.net
Replied by Jiliko.net on topic Plugins in generic.php
Hi Mihail,
You have to add Joomla! plugin code you can find in 'components/com_k2/models/item.php' in the prepareItem() function.
You have to declare the Joomla! dispatcher :
$dispatcher = &JDispatcher::getInstance();
import Joomla content plugins :
JPluginHelper::importPlugin ('content');
import K2 plugins :
JPluginHelper::importPlugin ( 'k2' );
trigger content events :
lines 283-298
and K2 events :
lines 347-364
Olivier
You have to add Joomla! plugin code you can find in 'components/com_k2/models/item.php' in the prepareItem() function.
You have to declare the Joomla! dispatcher :
$dispatcher = &JDispatcher::getInstance();
import Joomla content plugins :
JPluginHelper::importPlugin ('content');
import K2 plugins :
JPluginHelper::importPlugin ( 'k2' );
trigger content events :
lines 283-298
and K2 events :
lines 347-364
Olivier
Please Log in or Create an account to join the conversation.
- Mihail Semerdzhiev
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
14 years 2 months ago #86631
by Mihail Semerdzhiev
Replied by Mihail Semerdzhiev on topic Plugins in generic.php
On this lines, i dont have any content events or k2 events :(
Please Log in or Create an account to join the conversation.
- Mihail Semerdzhiev
- Topic Author
- Offline
- New Member
Less
More
- Posts: 12
14 years 2 months ago #86632
by Mihail Semerdzhiev
Replied by Mihail Semerdzhiev on topic Plugins in generic.php
I do it something wrong. I'm try everything but still cant load the plugins.
Please Log in or Create an account to join the conversation.
- Pedro Alcaraz Mayor
- Offline
- New Member
Less
More
- Posts: 3
13 years 6 months ago #86633
by Pedro Alcaraz Mayor
Replied by Pedro Alcaraz Mayor on topic Plugins in generic.php
This change has worked for me in the file /templates/<YOUR-TEMPLATE>/html/com_k2/templates/generic.php<br/>
<br/><br/>
<br/>
Pedro Alcaraz
<br/>
<br/>
<br/>
<?php if($item->params->get('itemVideo') && !empty($item->video)): ?>
<!-- Item video --> <a name="itemVideoAnchor" id="itemVideoAnchor"></a><br/>
<br/>
<div class="itemVideoBlock">
<?php
$params = & JComponentHelper::getParams('com_k2');
$limitstart=0;
if (!empty($item->video) && JString::substr($item->video, 0, 1) !== '{') {
$item->video = '<div class="K2FeedVideo">'.$item->video.'</div>';
}
else {
//$params->set('vwidth', $item->params->get('itemVideoWidth'));
$params->set('vwidth',320);
$params->set('vheight', intval(($item->params->get('itemVideoHeight')*320)/480));
$params->set('autoplay', $item->params->get('itemVideoAutoPlay'));
$params->set('vfolder', 'media/k2/videos');
if(JString::strpos($item->video, 'remote}')){
preg_match("#}(.*?){/#s",$item->video, $matches);
if(!JString::strpos($matches[1], 'http://}'))
$item->video = str_replace($matches[1], JURI::root().$matches[1], $item->video);
}
$dispatcher = &JDispatcher::getInstance();
JPluginHelper::importPlugin ('content');
$item->text=$item->video;
$dispatcher->trigger ( 'onPrepareContent', array (&$item, &$params, $limitstart ) );
$item->video= '<div class="K2FeedVideo">'.$item->text.'</div>';
//echo '<pre>' . $item->description . '</pre>';
}
?>
<?php if($item->videoType=='embedded'): ?>
<div class="itemVideoEmbedded">
<?php echo $item->video; ?>
</div>
<?php else: ?>
<span class="itemVideo"><?php echo $item->video; ?></span>
<?php endif; ?><br/>
<br/>
<?php if($item->params->get('itemVideoCaption') && !empty($item->video_caption)): ?>
<span class="itemVideoCaption"><?php echo $item->video_caption; ?></span>
<?php endif; ?><br/>
<br/>
<?php if($item->params->get('itemVideoCredits') && !empty($item->video_credits)): ?>
<span class="itemVideoCredits"><?php echo $item->video_credits; ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<br/>
Pedro Alcaraz
Please Log in or Create an account to join the conversation.
- TOTHOMweb
- Offline
- New Member
10 years 10 months ago #86634
by TOTHOMweb
Replied by TOTHOMweb on topic Re: Plugins in generic.php
Tanks Pedro, that worked perfectly!
I used this cleared code (without <br/>):
I used this cleared code (without <br/>):
Log in or Create an account to join the conversation.