LPH
Well-known member
I'm finally pushing forward on a free add-on for the community. It's kicking my butt because my knowledge of MVC and the XenForo way is different from the WordPress spaghetti
I'm really trying to wrap my head around things.
First, using templateHooks is deprecated since XF 1.2, correct? So code like this is "out-dated"
If template hooks are deprecated then how does the add-on hook into XenForo so a new page is created? Yes, the above code does a link in the footer because I am following Kier's video on template hooks. But now I'm trying to find where tutorials are for adding a page via an add-on (not via the ACP).
Any guidance would be appreciated.
I'm really trying to wrap my head around things.
First, using templateHooks is deprecated since XF 1.2, correct? So code like this is "out-dated"
PHP:
class XenAddOn_Listener_core
{
public static function templateCreate(&$templateName, array &$params, XenForo_Template_Abstract $template)
{
if($templateName == 'PAGE_CONTAINER')
{
$template->preloadTemplate('xenaddon_main');
}
}
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
switch ($hookName)
{
case 'footer_links':
{
$contents .= '<li><a href="/community/link_to_addon_page">An Add-on</a></li>';
break;
}
case 'navigationTabs':
{
$contents .= $template->create('xenaddon_main');
break;
}
}
}
}
If template hooks are deprecated then how does the add-on hook into XenForo so a new page is created? Yes, the above code does a link in the footer because I am following Kier's video on template hooks. But now I'm trying to find where tutorials are for adding a page via an add-on (not via the ACP).
Any guidance would be appreciated.