ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

sitemap navigation

May 20, 2013 11:47am

Subscribe [2]
  • #1 / May 20, 2013 11:47am

    somvannda

    37 posts

    Is there anything special in EE to get all the segment name as a sitemap?

    For example I have http://domain.org//whoweare/organisation/vision-mission-and-values

    I wanna display You are now - Whoweare / Organisation / Vision-mission-and-values

    and each path is a link to its own page.

    Thanks.
    Somvannda

  • #2 / May 20, 2013 4:05pm

    travisb

    172 posts

    What about doing something like:

    <style type="text/css">
     .captxt { text-transform:capitalize; }
    </style>
    <em>
     <a href="/{segment_1}" class="captxt">{segment_1}</a> | 
     <a href="/{segment_1}/{segment_2}" class="captxt">{segment_2}</a> | 
     <a href="/{segment_1}/{segment_2}/{segment_3}" class="captxt">{segment_3}</a>
    </em>

    Or you might check out some add-ons for breadcrumbs like http://devot-ee.com/add-ons/crumbly

     

  • #3 / May 20, 2013 9:56pm

    somvannda

    37 posts

    HI

    THank you for your reply to help me out, but what I want is to let the code checks automatically whether it has 3 or 4 segments itself and it will release the path dynamically.

    Doing your way is okay, but when I have only 2 segments, it will be a mistake.

    Thanks

  • #4 / May 20, 2013 10:28pm

    travisb

    172 posts

    In that case, you could add a conditional in to see if the segment is empty:

    <style type="text/css">
     .captxt { text-transform:capitalize; }
    </style>
    <em>
     <a href="/{segment_1}" class="captxt">{segment_1}</a>
     {if segment_2} | <a href="/{segment_1}/{segment_2}" class="captxt">{segment_2}</a>{/if}
     {if segment_3} | <a href="/{segment_1}/{segment_2}/{segment_3}" class="captxt">{segment_3}</a>{/if}
    </em>
  • #5 / May 20, 2013 11:03pm

    somvannda

    37 posts

    Hi

    Yeah that is what I am looking for, I have no idea what condition of any variables should I use to check if the segment is empty.

    Thanks

    In that case, you could add a conditional in to see if the segment is empty:

    <style type="text/css">
     .captxt { text-transform:capitalize; }
    </style>
    <em>
     <a href="/{segment_1}" class="captxt">{segment_1}</a>
     {if segment_2} | <a href="/{segment_1}/{segment_2}" class="captxt">{segment_2}</a>{/if}
     {if segment_3} | <a href="/{segment_1}/{segment_2}/{segment_3}" class="captxt">{segment_3}</a>{/if}
    </em>
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases