• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

autogenerate forum list on other templates?

island

Active member
#1
I'm thinking of fleshing out some error pages like the xenForo 404 page to provide more things to peak a visitor's interest and maybe decrease bounce.

Is there an easy way to include a linked list of forums on other pages? (like the list that appears if you hit the bottom arrow? Members obviously know it's there but I'm not sure first-time visitors will know what that is so I'd like to provide a full linked list right front and center on some error pages like the 404)
 

island

Active member
#3
Thanks. I do see the code in the quick_navigation_menu template but I don't know what it means for it to be a page and am not sure how to get it to execute the forum list in the error template (copying the whole quick_navigation_menu code into the error template as a test reproduced the general items but the forum list is unpopulated/blank on the error page)
 
R

ragtek

Guest
#4
The nodes aren't available in the global scope:(

you'll need to add the nodes
PHP:
    public function actionQuickNavigationMenu()
    {
        $route = $this->_input->filterSingle('route', XenForo_Input::STRING);

        /* @var $nodeModel XenForo_Model_Node */
        $nodeModel = $this->getModelFromCache('XenForo_Model_Node');

        $nodes = $nodeModel->getViewableNodeList(null, true);
        $nodeTypes = $nodeModel->getAllNodeTypes();

        $quickNavMenuNodeTypes = XenForo_Application::get('options')->quickNavMenuNodeTypes;

        if (!isset($nodeTypes['_all']) && !in_array('_all', $quickNavMenuNodeTypes))
        {
            $nodes = $nodeModel->filterNodeTypesInTree($nodes, $quickNavMenuNodeTypes);
        }

        $nodes = $nodeModel->filterOrphanNodes($nodes);

        $selected = preg_replace('/[^a-z0-9_-]/i', '', $this->_input->filterSingle('selected', XenForo_Input::STRING));

        $options = XenForo_Application::get('options');

        $viewParams = array(
            'route' => $route,
            'nodes' => $nodes,
            'nodeTypes' => $nodeTypes,
            'selected' => $selected,

            'homeLink' => ($options->homePageUrl ? $options->homePageUrl : false)
        );

        return $this->responseView('XenForo_ViewPublic_Misc_QuickNavigationMenu', 'quick_navigation_menu', $viewParams);
    }