Hi everybody,
I´m trying to build a plugin that displays some content inline and would like to use onK2PrepareContent - but it does not work. The Code below is loaded but never comes to onK2PrepareContent function.
Can anybody help me out?
Thanks
Bastian
<?php
/**
* @version 1.0
* @package Inline Advertising (K2 plugin)
* @author Bastian Schneider - www.internet-konzepte.com
* @copyright Copyright (c) 2006 - 2012 Bastian Schneider
* @license GNU/GPL license: www.gnu.org/copyleft/gpl.html
*/
defined('_JEXEC') or die ('Restricted access');
JLoader::register('K2Plugin', JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'k2plugin.php');
class InlineAdvertising extends K2Plugin {
var $pluginName = 'inlineads';
var $pluginNameHumanReadable = 'Inline Advertising Plugin';
function InlineAdvertising( & $subject, $params) {
parent::__construct($subject, $params);
$this->_plugin = JPluginHelper::getPlugin( 'content', 'jwsig' );
}
function onK2PrepareContent( &$item, &$params, $limitstart) {
$mainframe = &JFactory::getApplication();
$this->item->extra_fields = K2ModelItem::getItemExtraFields($this->item->extra_fields);
$extraFlds = array();
if ( $this->item->extra_fields ){
foreach ( $this->item->extra_fields as $key=>$extraField ){
$extraFlds[ $extraField->name ] = $extraField->value;
$test.=$extraField->name;
}
}
$item->text = 'It works! '.$test.$item->text;
}
} // END CLASS
I´m trying to build a plugin that displays some content inline and would like to use onK2PrepareContent - but it does not work. The Code below is loaded but never comes to onK2PrepareContent function.
Can anybody help me out?
Thanks
Bastian
<?php
/**
* @version 1.0
* @package Inline Advertising (K2 plugin)
* @author Bastian Schneider - www.internet-konzepte.com
* @copyright Copyright (c) 2006 - 2012 Bastian Schneider
* @license GNU/GPL license: www.gnu.org/copyleft/gpl.html
*/
defined('_JEXEC') or die ('Restricted access');
JLoader::register('K2Plugin', JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'k2plugin.php');
class InlineAdvertising extends K2Plugin {
var $pluginName = 'inlineads';
var $pluginNameHumanReadable = 'Inline Advertising Plugin';
function InlineAdvertising( & $subject, $params) {
parent::__construct($subject, $params);
$this->_plugin = JPluginHelper::getPlugin( 'content', 'jwsig' );
}
function onK2PrepareContent( &$item, &$params, $limitstart) {
$mainframe = &JFactory::getApplication();
$this->item->extra_fields = K2ModelItem::getItemExtraFields($this->item->extra_fields);
$extraFlds = array();
if ( $this->item->extra_fields ){
foreach ( $this->item->extra_fields as $key=>$extraField ){
$extraFlds[ $extraField->name ] = $extraField->value;
$test.=$extraField->name;
}
}
$item->text = 'It works! '.$test.$item->text;
}
} // END CLASS