how to change / remove the container from page nodes

Jake Bunce

Well-known member
I got this question via PM, but I am posting the answer here.

This requires a little bit of code. Create this file:

library/Callback/PageNode.php

Rich (BB code):
<?php

class Callback_PageNode
{
	public static function noContainer(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
	{
		$response->containerParams['containerTemplate'] = 'mycontainer';
	}
}

It names a new container template (to replace PAGE_CONTAINER). Then you need to create that template:

Admin CP -> Appearance -> Templates -> Create New Template

The template needs to contain this at a minimum:

Code:
{xen:raw $contents}

That will output just the content of the page without any "html wrapper" which would normally be part of the container. You can surround that code with html if you wish, such as a standard <html><head><body> skeleton.

Note that there is also a lesser container of sorts for page nodes which is usually called the content template:

Admin CP -> Appearance -> Templates -> pagenode_container

The rendered output of this template is what is normally inserted into the container. You can override that template name like this:

Rich (BB code):
<?php

class Callback_PageNode
{
	public static function noContainer(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
	{
		$response->containerParams['containerTemplate'] = 'mycontainer';

		$response->templateName = 'mycontent';
	}
}

Then you need to create that template:

Admin CP -> Appearance -> Templates -> Create New Template

At a minimum it should contain this code to output the template html for your page node:

Code:
{xen:raw $templateHtml}

And after all of this... you need to specify the callback when adding/editing your page node. The callback is:

Callback_PageNode::noContainer
 
Thank you Jake. I'm going to try to wrap my brain around this and hopefully be able to follow your directions.
 
Top Bottom