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

Better solution for fetching nodes list in templates

Discussion in 'XenForo Development Discussions' started by Marcus, Feb 7, 2012.

  1. Marcus

    Marcus Well-Known Member

    Currently I fetch the current node and all parent nodes with

    <div style="display:none"><xen:include template="breadcrumb"></xen:include></div>

    I modify this template to give me the right output for this include, and the regular output if it is called not from my template. This is not perfect. Is there another possibility of getting both the a) actual node list and b) all nodes? Thanks.

  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It sounds like you are extracting node information from the breadcrumbs on the page. That works if you want to access the current path through the node tree. But it won't give you access to nodes outside of that path.

    Exactly what node information do you need and where? Context is required before I can be more specific.
  3. Marcus

    Marcus Well-Known Member

    Currently I just need the node path, so I make use of the breadcrumbs template. I display the template in addition as I need the information right after <body>.

    I am also looking forward for a script that displays the siblings of the father element, and maybe more - thus I need all nodes.

    Do you know of the most easy way to accomplish this?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Then you will need to create an addon to fetch those other nodes. Ragtek posted example code from XenForo_ControllerPublic_Misc. That code fetches the node records and makes them available as a viewParam for use in the content template (quick_navigation_menu in that example).
    Marcus likes this.

Share This Page