based on the this tutorial https://docs.joomla.org/J3.x:Creating_a_content_plugin I managed to write my first content plugin with this helper.php code

        $regex_cat = '/{reillorama:(.*?)}/i';

    preg_match_all($regex_cat, $article->text, $matches);

        if ($matches)

            $path = JPluginHelper::getLayoutPath('content', 'reillorama');

            foreach ($matches[1] as $catid)

            $image = new images();
            $image ->categoryid = $catid;
            $allimages = $image ->getImages();

            include $path;
            $html = ob_get_contents();

            $regex_cat = '/{reillorama:' . str_replace('.', '\.', str_replace('/', '\/', $catid)) . '}/is';

            $article->text = preg_replace($regex_cat, $html, $article->text);


this code takes the catid from my plugin syntax {reillorama:"catid"} where "catid" is a number.

Now I need two more params like "navigation"(charset) and "title"(number). The final syntax code looks like {reillorama:5/dots/1}.

How can i extract those values from the input code and parse them to my default.php tmpl?

  • I was the one who voted for closing this question... I still don't see anything Joomla in it, This is a php: preg_match/explode question.
    – FFrewin
    Jun 27 '17 at 5:52
  • You should not be using str_replace() calls to escape characters in your $regex_cat pattern -- this what preg_quote() is for. Your question requirements are not clear to me, so I cannot offer a refined solution for your issue.
    – mickmackusa
    Nov 30 '18 at 12:43

here is a very comprehensive solution


it explodes all values

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.