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"?


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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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