I just want to display simple text and this is not working.

I don't know is there a way to see something like log to see what happens in the background?

 public function onContentPrepare($context, &$row, &$params, $page = 0)
        $row->text = str_replace("LOREM", "some thing", $row->text);
        echo "print some thing";
        return "print some thing";

I try in three way to display some thing.

  • 2
    To see what's happening in the background I'd recommend to use a good IDE (PHPStorm, Visual Studio etc) in combination with XDebug. That combination gives you the possibility to step through your code, and see all variables and their values.
    – pe7er
    Feb 2, 2022 at 18:12
  • 1
    To address one of your attempts: Joomla Documentation: Plugin/Events/Content and Creating a content plugin Sometimes when I am debugging and want to output to my screen, I use Factory::getApplication()->enqueueMessage() ...maybe give that a try, I don't know if it will work, I didn't test it. Example Feb 2, 2022 at 21:32
  • @mickmackusa tnx, that worked too
    – Husen
    Feb 3, 2022 at 19:51

1 Answer 1


I don't know why CMSPlugin does not work for this problem. the first step is to delete namespace on the .xml file and then use JPlugin instead of CMSPlugin

class PlgContentFirstplugin extends JPlugin
    public function onContentPrepare($context, &$row, &$params, $page = 0)
        $row->text = str_replace("LOREM", "normal Lorem", $row->text);


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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