Is there any way to get full rendered page before returning to the browser? I want to get full page (from <html> to </html>), replace some pseudo variables and retrun to user changed verstion. I can do this using index.php but I looks ugly.

Maybe there is a callback like "on after page rendered"?


1 Answer 1


To edit entire HTML output directly, create a system plugin with onAfterRender event. Use application's getBody() method to get the content and setBody() to save the modified content.

defined('_JEXEC') or die;

    protected $app;

    public function onAfterRender()
        if ($this->app->getDocument()->type !== 'html')

        $body = $this->app->getBody();

        //do modifications to $body here


But if the content you want to replace is only inside content items (e.g. shortcodes in articles), create a content plugin with onContentPrepare event and only modify the article 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.