• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

how to change / remove the container from page nodes

Jake Bunce

XenForo moderator
Staff member
#1
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

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:

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