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

XF 1.1 how can I display value of an element of an array?

#1
Hello, I am looking for a way to display value of an element of an array (in the template)

Code:
<nodeBreadCrumbs>
array
  7 =>
    array
      'href' => string 'http://localhost/xenforo113/forum/#7' (length=37)
     @'value' => string 'Category 1' (length=10)
      'node_id' => int 7
  10 =>
    array
      'href' => string 'http://localhost/xenforo113/forums/10/' (length=39)
      'value' => string 'Forum 1' (length=7)
      'node_id' => int 10


7 and 10 is the node_id of the current forum, how can I display a value of an element above? For example @: Value of 7 to be used in the template.
Thanks.
 
#3
Thanks @Jake!
it works fine in thread_view. but forum_view not.
in forum_view, I have tried {$nodeBreadCrumbs.{$forum.node_id}.value} but not working.
Is there a way in foum_view?
 

Jake Bunce

XenForo moderator
Staff member
#4
Thanks @Jake!
it works fine in thread_view. but forum_view not.
in forum_view, I have tried {$nodeBreadCrumbs.{$forum.node_id}.value} but not working.
Is there a way in foum_view?
The current forum is not part of $nodeBreadCrumbs in forum_view. You will notice that you don't see that breadcrumb on the page.

Here is a file edit to include the current node as the last breadcrumb:

http://xenforo.com/community/threads/add-more-to-the-breadcrumb.35756/#post-407105
 
#5
Sorry for my english.
The structure of the forum are:
Home> forum A> forum B> forum C> Thread.
For example, we are in the forum C, I want to display the title of the forum B in the content.
I have tried to remove the red code: (library/XenForo/ControllerPublic/Forum.php)



Code:
$viewParams = array(
            'nodeList' => $this->_getNodeModel()->getNodeDataForListDisplay($forum, 0),
            'forum' => $forum,
            'nodeBreadCrumbs' => $ftpHelper->getNodeBreadCrumbs($forum, false),
 
            'canPostThread' => $forumModel->canPostThreadInForum($forum),
            'canSearch' => $visitor->canSearch(),
 
            'inlineModOptions' => $inlineModOptions,
            'threads' => $threads,
            'stickyThreads' => $stickyThreads,
 
            'ignoredNames' => $this->_getIgnoredContentUserNames($threads) + $this->_getIgnoredContentUserNames($stickyThreads),
 
            'order' => $order,
            'orderDirection' => $orderDirection,
            'orderParams' => $orderParams,
            'displayConditions' => $displayConditions,
 
            'pageNavParams' => $pageNavParams,
            'page' => $page,
            'threadStartOffset' => ($page - 1) * $threadsPerPage + 1,
            'threadEndOffset' => ($page - 1) * $threadsPerPage + count($threads) ,
            'threadsPerPage' => $threadsPerPage,
            'totalThreads' => $totalThreads,
 
            'showPostedNotice' => $this->_input->filterSingle('posted', XenForo_Input::UINT)
        );
 
        return $this->responseView('XenForo_ViewPublic_Forum_View', 'forum_view', $viewParams);



And the {$nodeBreadCrumbs.{$forum.node_id}.value} display title of the forum C (current forums) that is not title of the forum B!