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

XF 1.2 Specify custom page_container for pagenode

Discussion in 'XenForo Questions and Support' started by Lee, Jul 8, 2013.

  1. Lee

    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
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    What are you looking to do exactly?

    Pages only have header, footer and breadcrumbs by default.
     
  3. Lee

    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.
     
  4. Brogan

    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;
    }
     
  5. Russ

    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
     
  6. Chris D

    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.
     
  7. Russ

    Russ Well-Known Member


    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.
     
  8. xf_phantom

    xf_phantom Well-Known Member

    Chris D likes this.
  9. Lee

    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.
     
  10. Lee

    Lee Well-Known Member

  11. xf_phantom

    xf_phantom Well-Known Member

    PHP:
    <?php
    class Test{


       public static function 
    changePage(XenForo_ControllerPublic_Abstract $controllerXenForo_ControllerResponse_Abstract &$response){
         
    $response->containerParams = array('containerTemplate' => 'foo');
       }
    }
    worked for me
     
    Lee and Chris D like this.
  12. Lee

    Lee Well-Known Member

    Thanks, I will try that now :)
     
  13. Lee

    Lee Well-Known Member

    Works exactly as hoped!
     

Share This Page