lasertits
Active member
I'm trying to make my first addon that isn't just a simple templateHook/Create. Basically I'm just trying to put a tab in the main nav, that goes to my custom page / template, and can go to sub pages and the breadcrumb will keep the right structure.
I've pulled off getting a tab in the nav with a drop down template, which goes to a index template, and the breadcrumb has "Home > Rules" (addon is for a bunch of rule pages), but I can't figure the best way to go about adding MORE pages, rather than JUST an index.
Here's what I have so far:
library/Rules/ControllerPublic/Index.php
library/Rules/Listener/NavTabs.php
library/Rules/Route/Prefix/Index.php
library/Rules/ControllerPublic/Index.php:
library/Rules/Listener/NavTabs.php:
library/Rules/Route/Prefix/Index.php:
And the two templates I put together quickly for testing:
Template Rules_NavTabs:
Just has 1 example link for now.
Template Rules_Index:
(not sure how to use the navigation/breadcrumb bits fully yet).
So to reiterate, I'm trying to figure out the best way to go about adding more rules pages / sub pages. Breadcrumb structure is important, probably going to have a structure similar to this:
Home > Rules (index / site and forum rules here)
Home > Rules > Global Server Rules (rules for all our game servers)
Home > Rules > CS:S (index listing sub pages perhaps)
Home > Rules > CS:S > Mini Games
Home > Rules > CS:S > Zombie Mod
Home > Rules > TF2 (index listing sub pages perhaps)
Home > Rules > TF2 > Payload 24/7
Home > Rules > TF2 > Stock 24/7
Home > Rules > Minecraft
etc.
I'd guess that each page would be its own template? E.g. Rules_SiteForum, Rules_GlobalServer, Rules_CSS, Rules_MiniGames, etc.
But again, I'm really not sure / have no idea - hence this thread. Looking for any input / insight so I can hopefully be pointed in the right direction on how to pull this off properly. Thanks.
I've pulled off getting a tab in the nav with a drop down template, which goes to a index template, and the breadcrumb has "Home > Rules" (addon is for a bunch of rule pages), but I can't figure the best way to go about adding MORE pages, rather than JUST an index.
Here's what I have so far:
library/Rules/ControllerPublic/Index.php
library/Rules/Listener/NavTabs.php
library/Rules/Route/Prefix/Index.php
library/Rules/ControllerPublic/Index.php:
PHP:
<?php
class Rules_ControllerPublic_Index extends XenForo_ControllerPublic_Abstract
{
public function actionIndex()
{
return $this->responseView('Rules_ViewPublic_Index', 'Rules_Index');
}
}
library/Rules/Listener/NavTabs.php:
PHP:
<?php
class Rules_Listener_NavTabs
{
public static function addNavbarTab(array &$extraTabs, $selectedTabId)
{
$extraTabs['rules'] = array(
'title' => new XenForo_Phrase('rules'),
'href' => XenForo_Link::buildPublicLink('full:rules'),
'position' => 'middle',
'selected' => ($selectedTabId == 'rules'),
'linksTemplate' => 'Rules_NavTabs',
);
}
}
library/Rules/Route/Prefix/Index.php:
PHP:
<?php
class Rules_Route_Prefix_Index implements XenForo_Route_Interface
{
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
return $router->getRouteMatch('Rules_ControllerPublic_Index', 'index', 'rules', $routePath);
}
}
And the two templates I put together quickly for testing:
Template Rules_NavTabs:
Code:
<ul class="secondaryContent blockLinksList">
<li><a href="{xen:link rules/global}">Global Server Rules</a></li>
</ul>
Just has 1 example link for now.
Template Rules_Index:
Code:
<xen:navigation>
<xen:breadcrumb source="$nodeBreadCrumbs" />
</xen:navigation>
Index Content
So to reiterate, I'm trying to figure out the best way to go about adding more rules pages / sub pages. Breadcrumb structure is important, probably going to have a structure similar to this:
Home > Rules (index / site and forum rules here)
Home > Rules > Global Server Rules (rules for all our game servers)
Home > Rules > CS:S (index listing sub pages perhaps)
Home > Rules > CS:S > Mini Games
Home > Rules > CS:S > Zombie Mod
Home > Rules > TF2 (index listing sub pages perhaps)
Home > Rules > TF2 > Payload 24/7
Home > Rules > TF2 > Stock 24/7
Home > Rules > Minecraft
etc.
I'd guess that each page would be its own template? E.g. Rules_SiteForum, Rules_GlobalServer, Rules_CSS, Rules_MiniGames, etc.
But again, I'm really not sure / have no idea - hence this thread. Looking for any input / insight so I can hopefully be pointed in the right direction on how to pull this off properly. Thanks.