Error with Joomla 3.x.x Shortcode plugin and module -
i want write joomla add-in articles can add count down timer. able run using, example, shortcode [countdowntimer date = "23-9-2017" time = "13:42"]
. not know how can add parameters shortcode , move them module. replacing [countdowntimer]
on counter i've done.
<?php defined( '_jexec' ) or die(); class plgcontentshortcode extends jplugin { protected $autoloadlanguage = true; function oncontentprepare ($context, $article, $params, $limitstart) { // preg_match("/([[]countdowntimer(.*)[]])/", $article->text, $tmp, preg_offset_capture); // i'm trying extract parameters in way // preg_match("/date=\"([0-9-]+)\"/", $tmp[2][0], $return_tmp['date'], preg_offset_capture); //date // preg_match("/time=\"([0-9:]+)\"/", $tmp[2][0], $return_tmp['time'], preg_offset_capture); // time $article->text = preg_replace('/([[]countdowntimer(.*)[]])/', '{loadmodule mod_countdowntimer}', $article->text); return true; } } ?>
in title mentioned have "error". don't exact problem code (beside doesn't work). instead of coding you're own plugin, can use existing extension this: https://extensions.joomla.org/extension/modules-anywhere/. extension can want.
but if create you're own plugin, take @ jmodulehelper
class load module parameters (see: https://api.joomla.org/cms-3/classes/jmodulehelper.html). result of jmodulehelper::rendermodule
string can append $article->text
Comments
Post a Comment