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

xen:if and breadcrumb navigation

Discussion in 'XenForo Development Discussions' started by thomas_, Jul 21, 2013.

  1. thomas_

    thomas_ Member

    I have pages with or without a category. If they are in a category i want my breadcrumb like this:

    Code:
    addon->category->article
    
    without category

    Code:
    addon->article
    
    the point is that it seems that templates only allow one navigation tag. If I use the xen:if tag outside the xen:navigation scope I am only able to render one breadcrumb.

    So to fit my needs my template would look like:

    Code:
    <xen:if is="{$category}">
             <xen:navigation>
                       <xen:breadcrumb href="{$categoryLink}">{$category}</xen:breadcrumb>
            </xen:navigation>
    </xen:if>
             <xen:navigation>
                      <xen:breadcrumb href="{$breadcrumbLink}">{$article.article_name}  </xen:breadcrumb>
    </xen:navigation>
    

    but this way only one navigation tag gets rendered. Not both of them.


    btw: xen:if tag inside of xen:navigation doesnt work (error)
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Try using xen:else and move the /xen:if to the end.
     
    thomas_ likes this.
  3. thomas_

    thomas_ Member

    Thanks, it works this way:

    Code:
    <xen:if is="{$category}">
             <xen:navigation>
                       <xen:breadcrumb href="{$categoryLink}">{$category}</xen:breadcrumb>
                       <xen:breadcrumb href="{$breadcrumbLink}">{$article.article_name} </xen:breadcrumb>
            </xen:navigation>
    <xen:else />
        <xen:navigation>
                      <xen:breadcrumb href="{$breadcrumbLink}">{$article.article_name}  </xen:breadcrumb>
        </xen:navigation>
    </xen:if>
    
     
    Marcus likes this.

Share This Page