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.
)
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:
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!
Setup/Installation is pretty easy. Follow the steps and you should be good to go.
- Extract the attached file into your library folder.
- 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 - 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 - 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
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.