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

Can we make new style for our route page?

Discussion in 'XenForo Development Discussions' started by timothy259856, Jun 12, 2015.

  1. timothy259856

    timothy259856 Active Member

    I want to create new page with my route, can I apply a new style for my page only? I mean that my page will not depend on Xenforo style (color, width...).
     
    arjune69 likes this.
  2. Adam K M

    Adam K M Active Member

    Just to clarify, you want to make a page node within XenForo that uses a different style than the rest of the forum?

    An easy built-in way of doing this is by 'forcing' that page to be in your custom pages' style, although I wouldn't recommend it (As I believe this become's the users' forum style unless they're force into another forum style through a different node, or change their style manually).

    Your custom pages' style would need to be created separately.
    upload_2015-6-25_10-31-7.png

    I'm not sure if this second method is good practice, but at the very least, it bypasses the above problem.

    In your PAGE_CONTAINER template, you can surround the current <head> and <body> with a xen:if statement, and using a xen:if statement, if the user is found to be on a certain page node, show an alternate set of content.

    PAGE_CONTAINER
    HTML:
    <xen:if is="{$pageId} == YOURPAGEID">
    <head><title>Custom Page</title></head>
    <body>
            {xen:raw $contents}
    </body>
    <xen:else />
    <!--- Default PAGE_CONTAINER CODE --->
    </xen:if>
    To get {$pageId} to work on PAGE_CONTAINER (since it's not normally available), on the pagenode_container template, you'll need to add:
    pagenode_container
    HTML:
    <xen:container var="$pageId">{$page.node_id}</xen:container>
    Hope that answers your question!
     
    timothy259856 likes this.
  3. James

    James Well-Known Member

    I think he wants a new style independent of any xenforo styles... In which case he can just create a new template and use that as his responseView in the code.
     
    timothy259856 likes this.
  4. timothy259856

    timothy259856 Active Member

    Yes, you right, I can handle with the CSS and some trick to override the CSS of XenForo :)

    Thank you for your help, I've create my own addon with my own route, I think the handle in the PAGE_CONTAINER is the good solution :)
     
    Adam K M likes this.

Share This Page