Can we make new style for our route page?

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...).
 
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.webp

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

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

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.
View attachment 109407

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!

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 :)
 
Top Bottom