Page 1 of 1

Get full parsed output from template

Posted: Sun Dec 22, 2019 10:44 am
by Erpenator
I would like to have the full output of phpbb from \phpbb\template\template so I can store it in memcached and generate an (HTML) output via the main caching server we have in place.

So far I have created an extension to pass all the classes I need:

Code: Select all

public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, \phpbb\cache\service $cache)
    {
        $this->auth = $auth;
        $this->config = $config;
        $this->template = $template;
        $this->user = $user;
    }
I am using the hook 'core.posting_modify_submit_post_after' => 'posting_modify_submit_post_after' to catch the output and tried different ways to get the output without succes. When I var_dump $this->template->display('body') I can see the output, but I am not able to find to only output the HTML.

The goal is to return HTML output as soon as possible to the page doesn't need to be regenerated again. At this moment the forum is too slow, mainly due to extensions and modifications we need and can't optimize any further.

Re: Get full parsed output from template

Posted: Sun Dec 22, 2019 11:31 am
by rxu
I guess it's something like $html = $this->template->assign_display('body');.

Re: Get full parsed output from template

Posted: Fri Jan 31, 2020 2:41 pm
by Erpenator
rxu wrote:
Sun Dec 22, 2019 11:31 am
I guess it's something like $html = $this->template->assign_display('body');.
This worked perfectly! Thank you.