XF 2.0 Create a completely blank page? (replace 'PAGE_CONTAINER')

Nikolov69

Member
Hi,

I'm trying to find a way to replace 'PAGE_CONTAINER' with another template (for a specific page only) - I just can't quite find the right way/place to do that. Any help would be appreciated.

Thank you!
 

Nikolov69

Member
I'm going to try that, thanks @au lait! I have two small follow-up questions:

I assume that what that does is set a value for $params.template which is then used in \XF\Pub\App:
1534098332349.png

Can I use this to override any parameters inside $params? (e.g. 'sidebar')

Finally, is there any way to do it using PHP, e.g. with a code event listener?
(I snooped around the code but the closest I came was the app_pub_render_page event which doesn't appear to provide a way to change the container template).
1534098879491.png

Sorry for the long post, I hope it doesn't call for too long a reply.
 

S Thomas

Well-known member
Inside params is btw possible:
Called just before the public page HTML is rendered.
Callback signature:
\XF\Pub\App $app, array &$params, \XF\Mvc\Reply\AbstractReply $reply, \XF\Mvc\Renderer\AbstractRenderer $renderer​
Arguments:
  1. \XF\Pub\App $app - Public App object.
  2. array &$params - Array of params being passed into the (container) template.
  3. \XF\Mvc\Reply\AbstractReply $reply - Reply object.
  4. \XF\Mvc\Renderer\AbstractRenderer $renderer - Renderer object.
So something like:
PHP:
public static function pubRenderListener(\XF\Pub\App $app, array &$params, \XF\Mvc\Reply\AbstractReply $reply, \XF\Mvc\Renderer\AbstractRenderer $renderer) {
    
    $params["key"] = "value";

}
should work.
 
Top