开发者

Joomla content plugin

开发者 https://www.devze.com 2023-01-11 18:27 出处:网络
How do I get this plugin triggered in the Joomla core \"user manager\" when a list of user is displayed?

How do I get this plugin triggered in the Joomla core "user manager" when a list of user is displayed?

I have already enabled in the plugins table but it is still not working. What I have not done?

// no direct access
defined('_JEXEC') or die('Restricted access');
// register the handler
$mainframe->registerEvent('onPrepareContent', 'plg开发者_运维技巧ContentUserswi');
/**
 * 
 * 
 * @param object Content item
 * @param JParameter Content parameters
 * @param int Page number
 */
function plgContentUserswi(&$row, &$params, $page)
{
    var_dump($row);
}


I might be wrong or misuderstood this book here. I am not saying the book is wrong but maybe I have misunderstand the interpretation or some earlier explaination that i have missed. on page 223 of this book it says the following:

Content
The content plugins allow us to modify content items before we display them. The most commonly used content event is onPrepareContent. This event, always the frst of all the content events to be triggered, is used to modify the text content. Let's imagine we want to create a content plugin which will replace all occurrences of :) with a small smiley face icon. This is how we could implement this:

// no direct access
defined('_JEXEC') or die('Restricted access');
// register the handler
$mainframe->registerEvent('onPrepareContent', 
                          'plgContentSmiley');
/**
 * Replaces :) with a smiley icon.
 * 
 * @param object Content item
 * @param JParameter Content parameters
 * @param int Page number
 */
function plgContentSmiley(&$row, &$params, $page)
{
  $pattern = '/\:\)/';
  $icon = '<img src="plugins/content/smiley.gif" />';
  $row->text = preg_replace($pattern, $icon, $row->text);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消