XF 1.2 Specify custom page_container for pagenode

Lee

Well-known member
Is it possible to specify a custom page_container template for a specific page node?

If so, does anybody have any examples of how to do so?

I'm thinking about making a new theme and using the "override theme choice" check box in the page_node settings, but it would be more ideal if I could just specify the new node container without having to "hack" it together.

Cheers,
Lee
 

Brogan

XenForo moderator
Staff member
What are you looking to do exactly?

Pages only have header, footer and breadcrumbs by default.
 

Lee

Well-known member
I want to remove the default xF style from a specific page node and add my own header / footer and styling.

Ie, make it look like it isn't associated with the forum at all.
 

Brogan

XenForo moderator
Staff member
Untested but you can try using a conditional statement for the node ID in the template.

Alternatively you can use the node ID in EXTRA.css to specifically target that page, for example:
Code:
.node25 #logo {
display: none;
}
 

Russ

Well-known member
Another thing you could do....

Create a new style how you want the page to display, editing mainly page_container then force a new style for the page in the page node options:

page.png
 

Chris D

XenForo developer
Staff member
He already said he didn't want to do that so it's not "hacked together" o_O

I see absolutely nothing wrong with doing as @Russ suggested, especially as it seems you wish to change the entire look and feel of that page -- overriding the style seems to be most appropriate.

If it is, however, a few small cosmetical changes then @Brogan's suggestions are perfect.
 

Russ

Well-known member
He already said he didn't want to do that so it's not "hacked together" o_O

I see absolutely nothing wrong with doing as @Russ suggested, especially as it seems you wish to change the entire look and feel of that page -- overriding the style seems to be most appropriate.

If it is, however, a few small cosmetical changes then @Brogan's suggestions are perfect.

Whoops! Didn't see that part :), yep I've done it for clients in the past and they've always been happy with it. I just install a child style underneath your main style.
 

Lee

Well-known member
Just to clarify, I didn't want to create two styles if I could just use a function to over-ride the default container with my own and keep everything in the same place.

I know I can use two styles to achieve this, but it seems like a long winded approach that could be done easily by creating one new template and overriding the default container.

Thanks for the suggestion @Brogan. @Russ I think this is the way I am going to proceed. Thanks for the help everyone.
 

xf_phantom

Well-known member
PHP:
<?php
class Test{


   public static function changePage(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response){
     $response->containerParams = array('containerTemplate' => 'foo');
   }
}
worked for me
 

Lee

Well-known member
PHP:
<?php
class Test{


   public static function changePage(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response){
     $response->containerParams = array('containerTemplate' => 'foo');
   }
}
worked for me
Works exactly as hoped!
 
Top