2

This code comes from 1.6 days.

{exp:weblog:entries weblog="static" sort="asc" offset="1" dynamic="off"}
     {if static_parent_page=="0"}     
      <li>
       <a class="active"href="{url_title_path=static/three_tier_d}">{title}</a>
       {reverse_related_entries weblog="static"}
        {if count==1}<ul>{/if}
        <li><a  class="active" href="{url_title_path=static/three_tier_d}">{title}</a></li>
        {if count==total_results}</ul>{/if}
       {/reverse_related_entries}
      </li>
     {/if}
    {/exp:weblog:entries} 

Since relationships was overhauled in 2.x, the reverse_related_entries tag in the above doesn't work. I need help to re-code it for EE 2.6

Full page code is at: http://www.train-ee.com/images/weblog/static_content_approach_d_activeclass.txt The result of the code is this page: http://www.train-ee.com/courseware/static/three_tier_d/

In a nutshell, the snippet does the following... Each entry has a special field called static_parent_page. If it isn't set, then the field is 0 and thus a top level navigation link. If the field is set to another entry, then we assume it is a child entry. So the code will display every child entry of a parent entry.

A 1000 thanks for helping with this!

3

You'll need the name of the relationship field on your parent entries.

Instead of using static_parent_page == 0, try a namespaced no_results.

{exp:channel:entries channel="static" sort="asc" offset="1" dynamic="off"}
  {static_parent_page}
    {if static_parent_page:no_results}
      <li>
       <a class="active" href="{url_title_path=static/three_tier_d}">{title}</a>
       {parents field="static_parent_page"}
        {if count == 1}<ul>{/if}
        <li><a class="active" href="{parents:url_title_path=static/three_tier_d}">{title}</a></li>
        {if count == total_results}</ul>{/if}
       {/parents}
      </li>
    {/if}
  {/static_parent_page}
{/exp:channel:entries}

The documentation about relationships is really good.

| improve this answer | |
  • static_parent_page is a field type relationship. See: train-ee.com/courseware/free-tutorials/comments/… Thanks! – DevServe Aug 8 '13 at 13:23
  • Did the answer helped you? – Robson Sobral Aug 8 '13 at 13:44
  • You don't have enough reputation for chat yet and I couldn't find a way to contact you. So, I gonna update my answer again. Please, test or look for me at twitter, so we can talk. @robsonsobral – Robson Sobral Aug 9 '13 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.