• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

How I created my external pages.

robdog

Well-known member
I decided to to a post here instead of making a plugin. If someone wants to take this and make a plugin, go for it. You guys are free to do whatever you want to the code. :)

Setup/Installation is pretty easy. Follow the steps and you should be good to go.
  1. Extract the attached file into your library folder.
  2. Create an Add-on (you will need to have the debug flag set in your config)
    Add-on ID: External Pages
    Title: External Pages
    Version String: 1
    Version ID: 1
  3. Create a route at the following URL:
    /admin.php?route-prefixes/
    Route Prefix: en
    Route Type: Public
    Route Class: ExternalPages_Route_Prefix_En
    Use Class to Build Link: Always
    Add-On: External Pages
  4. Create a Code Event Listener (optional if you want to add nav tabs for your external pages)
    Listen to Event: navigation_tabs
    Execute Callback: ExternalPages_Listeners_Navigation::navtabs
    Callback Execution Order: 1
    Add-on: External Pages
You are pretty much done, but you are DEFINITELY going to want to customize further and you still need to add the templates. (so continue reading :p)

Now you might not want to use "/en/" as your external pages prefix, and that is totally fine and completely up to you. The reason I put my pages in a sub-folder is so I could use the case statement to display the specific Controller Page. (which is in the En.php file under the Router/Prefix directory) Otherwise you have to create a route for each external page and a function for each route handler. (I think, lol. Haven't played with that part yet. :))

You will notice that the new NAV tab are setup for my sites. (NFL fan site) You can change any/all of the tabs in the Navigation.php under the Listerners folder.

Under the ControllerPublic folder, you will notice that EACH pages has its own PHP file. I copied some code from XenPorta to create a few of the sidebar pieces in each of the pages. Eventually, I am going to add a function to build right rails, but for now each pages has its own right rail creation code. Of course, you can ADD or remove these(ControllerPublic Pages) as you see fit.

Inside each ControllerPublic file you will see that it displays a template from this line:
return $this->responseView('ExternalPages_ViewPublic_Advertise', 'EP_Advertise', $viewParams);

The above line was from the Advertise.php file under the ControllerPublic folder. I am hoping that you guys can pick up on the naming scheme that I am using and can figure out how to modify these files to match your preferences and external pages.

Each ControllerPublic file can have its OWN set of information you assign into the template through the $viewParams array. Most of the pages I have provided only assign onlineUsers and boardTotals. Of course, you can assign as many more variables as you need.

Now for the templates you will need to create. Lets look at the EP_Advertise template:

Code:
<xen:h1>Welcome to Seahawks Huddle Advertising</xen:h1>
<xen:title>Advertise on Seahawks Huddle</xen:title>
<xen:description>Enter a META description/page description here.</xen:description>

<xen:navigation>
    <xen:breadcrumb href="{xen:link full:en/advertise/}">Advertise With Us</xen:breadcrumb>
</xen:navigation>

ENTER STATIC ADVERTISING TEMPLATE INFORMATION HERE.

<xen:sidebar>
    <xen:include template="sidebar_online_users" />
    <xen:include template="forum_stats" />
</xen:sidebar>

The one thing you should note in the above template at the reason why I posted it is because it is NOT in the Navigation.php file. So I have to add the breadcrumb through the template file. All the external pages that you put in the Navigation.php will NOT need the breadcrumb code in the template.

I added a screen shot of what my SCHEDULE page looks like. You can see that the custom NAVBAR option lights up. Each external pages uses the BASE Right Rail from the PAGE_CONTAINER template. You can add elements to each template between the <xen:sidebar></xen:sidebar> tags.

Holy crap that was a lot longer than I thought it was going to be. I will do my best to answer questions. :) The name of the game here is to just play. That is pretty much what I did and I came up with this. :) I will have my site launching in about 48 hours so you can see a live demo or get this going on your own. Good luck and I love this damn software!
 

Attachments

  • ExternalPages.zip
    ExternalPages.zip
    4.9 KB · Views: 367
  • external_page_schedule.gif
    external_page_schedule.gif
    146.5 KB · Views: 918
Each external page can look different. The template I post above will have breadcrumbs and a side bar.

And yes, your external pages CAN have custom NAV tabs. I attached a file that ADDS 3, but they are for my site (Tickets, Schedule, Draft). You can change them to whatever you want. (add some or remove some)
 
whoa.
That page looks great !
So good, I'm giving it my Xenforo T-Shirt award ! :)

xenforo.Tshirt.webp

Addendum: I don't think the Seahawks are going to be effective at selling women's shampoo, but hey, I'm not in marketing !
 
whoa.
That page looks great !
So good, I'm giving it my Xenforo T-Shirt award ! :)

Addendum: I don't think the Seahawks are going to be effective at selling women's shampoo, but hey, I'm not in marketing !

haha... after I posted it I thought of refreshing the page and getting a new ad, but now I am just going to let it ride. :) (got to love Google)
 
Each external page can look different. The template I post above will have breadcrumbs and a side bar.

And yes, your external pages CAN have custom NAV tabs. I attached a file that ADDS 3, but they are for my site (Tickets, Schedule, Draft). You can change them to whatever you want. (add some or remove some)

you accomplished this via the navigation.php file?
 
you accomplished this via the navigation.php file?

Navigation.php is specifically for adding custom navigation tabs. This is optional and you can remove it all together and remove the event listener that is attached to it as well.

Each pages has its own controller PHP file which is in the ControllerPublic folder. Inside each of those PHP files you will see it assigned an array values to be used by a template. Those templates can be customized to look and feel however you want.

I will have my XenForo site up tonight around 11:00pm PST, which will have a number of external pages in use.
 
I installed it on my system... works great. I found the three extra tabs on the navbar. To make sure I understand, I create a template for each of those extra tabs, and then the page will show when I select the tabs..

excellent addon, brings me closer to trying to create my own. peace
 
I installed it on my system... works great. I found the three extra tabs on the navbar. To make sure I understand, I create a template for each of those extra tabs, and then the page will show when I select the tabs..

excellent addon, brings me closer to trying to create my own. peace

Yes, lets say you didn't change any of the PHP files and you click on the Schedule Tab. It will look for the "EP_Schedule" template.
 
got it... THANK YOU! additionally, how would I turn off this addon from the ACP? extra tabs are only thing affected when clearing checkbox in the Addon listing from the ACP.

how to do submenus??
 
got it... THANK YOU! additionally, how would I turn off this addon from the ACP? extra tabs are only thing affected when clearing checkbox in the Addon listing from the ACP.

how to do submenus??


Unchecking the addon will only remove the custom tabs. If you disable the custom route, you will disable the external pages.

I have not played with sub-pages yet, but I have a second website that I am going to be working with that will require sub-options.

I will update this thread when I add sub-options.
 
external pages need tobe driven from navigation.php then ... external tab data. think about embedding subtabs within external paves in addition to option of having submenus on the navbar .. peace
 
You can change the files to do that. However, I will leave my Navigation.php to only control the navigation. Because you might have some external pages that do not have navigation tabs. (terms, privacy, advertising, etc...)
 
You can change the files to do that. However, I will leave my Navigation.php to only control the navigation. Because you might have some external pages that do not have navigation tabs. (terms, privacy, advertising, etc...)

light just came on upstairs... you have given me more ideas... I like your addon.
 
I am hoping the guys from vbAdvanced keep true to their promise on xfAdvanced. :) One can dream right!

Point being, this will unlikely be something default in the system.
 
Top Bottom