Add-on developers will likely have noticed that (almost) all XenForo output for the public-facing side of the application is contained within a single template, called PAGE_CONTAINER.
Individual page templates only allow you to build the HTML within the content area, though there are various XenForo template syntax systems that allow you to pass commands and data to the container, the most obvious of which is the ubiquitous <xen:title>Page Title Here</xen:title> here construction.
However, as time goes on and add-on applications grow more complex, you are likely to find that you want to output your data into your own custom container. The good news is, it's easy to do so. All you need to do it pass a containerTemplate variable to your view layer.
Here's an example of how to do that:
The only thing to note here is how we pass containerTemplate as a value of the array that is the fourth argument to responseView().
Of course, if you decide to use your own container template, you need to handle everything yourself. Breadcrumbs, headers and footers, sidebars... all that stuff is handled by the container template and if you don't implement something in your own container template, it won't be there when content templates call for it. Study the default PAGE_CONTAINER template for everything you need to know.
Individual page templates only allow you to build the HTML within the content area, though there are various XenForo template syntax systems that allow you to pass commands and data to the container, the most obvious of which is the ubiquitous <xen:title>Page Title Here</xen:title> here construction.
However, as time goes on and add-on applications grow more complex, you are likely to find that you want to output your data into your own custom container. The good news is, it's easy to do so. All you need to do it pass a containerTemplate variable to your view layer.
Here's an example of how to do that:
PHP:
class MyAddOn_ControllerPublic_Something extends XenForo_ControllerPublic_Abstract
{
public function actionIndex()
{
// do stuff here to build $viewParams array and then...
return $this->responseView(
'MyAddOn_ViewPublic_Something_Index', // view name
'some_template', // content template name
$viewParams, // data to be passed to content template
array('containerTemplate' =>
'MyAddOn_Page_Container_Template') // your own container template
);
}
}
Of course, if you decide to use your own container template, you need to handle everything yourself. Breadcrumbs, headers and footers, sidebars... all that stuff is handled by the container template and if you don't implement something in your own container template, it won't be there when content templates call for it. Study the default PAGE_CONTAINER template for everything you need to know.