Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

SpiderSometimes it's needed to parse something with joomla plugins. For example, you are changing a module template and want it's content to be parsed by plugins. Or you write your own component.

echo JHTML::_('content.prepare',$text_to_be_parsed);

This is the way I used when I was young and silly:

I took the following function from VirtueMart 1.1.4 with minimal changes. I think, some lines can be skipped in some cases. I'm not sure of $params. I just want to illustrate the approach.

function ParseContentByPlugins( $text, $type = 'content' ) { 
$params        =& $GLOBALS['mainframe']->getParams('com_content');
$dispatcher       =& JDispatcher::getInstance();
JPluginHelper::importPlugin($type);
$row = new stdClass();
$row->text = $text;
$results = $dispatcher->trigger('onPrepareContent', array (&$row, & $params, 0 ));
$text = $row->text;
return $text;       
}

Comments   

grandduke
# grandduke 2011-09-29 15:29
thanks for this tip..
:lol:
gigi
# gigi 2011-10-04 21:35
great tip. thanks a lot.

Please register to post comments.

Found a typo? Please select it and press Ctrl + Enter.
FaLang translation system by Faboba
Електронна бібліотека «Exlibris»: історичні дослідження, мемуаристика, публіцистика, художня література Українська етнографія: книги, курси лекцій, статті й матеріали, мапи, фотоальбоми, веб-ресурси Правителі України: портрети, життєписи, матеріали Твори Адріана Кащенка: романтика козацьких часів Народна війна 1917-1932

See a typo?

Select the text block and press

CTRL+Enter

Comments

  • NotificationAry - get emails on Joomla content is submitted, added or changed

    Berndi Berndi 30.06.2019 11:45
    The fields %TO_NAME% and %TO_USERNAME% are empty

    Read more...

     
  • NotificationAry - get emails on Joomla content is submitted, added or changed

    Berndi Berndi 30.06.2019 11:43
    My fault, I made it

    Read more...

     
  • NotificationAry - get emails on Joomla content is submitted, added or changed

    Berndi Berndi 30.06.2019 10:46
    I did. Now I'm asking me how to put the surename into the email... :-|

    Read more...

     
  • NavigationAry - navigate between Joomla menu items like between articles using "prev - next"

    Berndi Berndi 29.06.2019 15:59
    I also miss content in %TO_NAME%

    Read more...

     
  • NotificationAry - get emails on Joomla content is submitted, added or changed

    Berndi Berndi 29.06.2019 15:15
    Hi gruz, I have the problem, that when I use the %AUTHOR% tag, the plugin dosen't send the author ...

    Read more...