1. 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?

Discussion in 'XenForo Questions and Support' started by 123conwood, Mar 31, 2013.

  1. 123conwood

    123conwood New Member

    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.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    123conwood likes this.
  3. 123conwood

    123conwood New Member

    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?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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
     
    123conwood likes this.
  5. 123conwood

    123conwood New Member

    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!
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You don't need $nodeBreadCrumbs for that. Just use:

    Code:
    {$forum.title}
    
    That will be the title of the current forum. This works in all content templates inside of a forum.
     
  7. 123conwood

    123conwood New Member

    I want the title of the forum B (as Parent Node of the current forum C)
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Oh. Try this:

    Code:
    {$nodeBreadCrumbs.{$forum.parent_node_id}.value}
    
     
    123conwood likes this.
  9. 123conwood

    123conwood New Member

    YES worked! Thank you very much for your help Jake. You really helped me a very important issue! ty ty :)
     

Share This Page