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

How to get all $nodes (depth, node_id, node_type_id, title)

time

Active member
#2
My class
PHP:
<?php
class LilTee_NodesInSidebar_ControllerPublic_Forum extends XFCP_LilTee_NodesInSidebar_ControllerPublic_Forum
{
    public function actionIndex()
    {
        $forumId = $this->_input->filterSingle('node_id', XenForo_Input::UINT);
        $forumName = $this->_input->filterSingle('node_name', XenForo_Input::STRING);
        if ($forumId || $forumName)
        {
            return $this->responseReroute(__CLASS__, 'forum');
        }

        if ($this->_routeMatch->getResponseType() == 'rss')
        {
            return $this->getGlobalForumRss();
        }

        $this->canonicalizeRequestUrl(
            XenForo_Link::buildPublicLink('forums')
        );
//Get nodes
        $nodeModel = $this->getModelFromCache('XenForo_Model_Node');

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

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

        $selected = preg_replace('/[^a-z0-9_-]/i', '', $this->_input->filterSingle('selected', XenForo_Input::STRING));    
//
        $viewParams = array(
            'nodeList' => $this->_getNodeModel()->getNodeDataForListDisplay(false, 0),
            'onlineUsers' => $this->_getSessionActivityList(),
            'boardTotals' => $this->_getBoardTotals(),
            'nodeTypes' => $nodeTypes,
            'selected' => $selected,
            'nodes' => $nodes
        );

        return $this->responseView('XenForo_ViewPublic_Forum_List', 'forum_list', $viewParams);
    }
}
I inserted to template 'forum_list' with content :
PHP:
            <h3 class="primaryContent">{xen:phrase forum_list}</h3>
            <div class="secondaryContent nodeList">
                <ol class="blockLinksList">
                    <xen:foreach loop="$nodes" value="$node">
                        <li class="d{$node.depth} {xen:if "{$selected} == 'node-{$node.node_id}'", 'OverlayScroller'}">
                            <a href="{xen:link {$nodeTypes.{$node.node_type_id}.public_route_prefix}, $node}"
                                class="{xen:if '{$node.node_type_id} == "Category"', 'OverlayCloser'} {xen:if "{$selected} == 'node-{$node.node_id}'", 'selected'}">
                                <span class="_depth{$node.depth} depthPad">{$node.title}</span>
                            </a>
                        </li>
                    </xen:foreach>
                </ol>
            </div>
and display well.
But I insert this to template 'ad_sidebar_top', it don't display. Can you help me?
And I want to display not only template 'ad_sidebar_top', I want to display var $nodes at all template, what should I do?
 
Last edited: