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.

"See also" code

March 10, 2011 10:36am

Subscribe [3]
  • #1 / Mar 10, 2011 10:36am

    marianway

    24 posts

    I have a template which uses info from a particular weblog which has three entries. So I get three different pages, and all these are working fine.

    On each of the three pages I would like to have a “See also” section with links to the other two pages, but cannot seem to achieve this.

    I have this code on another template, which works well to bring up links to all three:

    {exp:weblog:entries weblog="courses" entry_id="15|32|49" disable="categories|member_data|pagination|trackbacks"}
    <div class=“entry-content”>
    {title}
    {g_intro}
    </div>
    {/exp:weblog:entries}

    But if I paste this directly into one of the three pages, all I get is the info relevant to the entry for that page. I have placed this code outside all other {exp:weblog:entries} tags but it make no difference.

    Do you have any ideas that may help me with this?

  • #2 / Mar 10, 2011 10:45am

    Ian Ebden

    312 posts

    You’re missing the dynamic=“no” parameter so your entries tag is parsing based on the url_segment.

  • #3 / Mar 10, 2011 10:55am

    marianway

    24 posts

    Thank you. That sorts out part of the problem. Now I can get all three links.

    😊

    Can you help on other part, which is how to get to just two links? (to the other 2 pages/entries, but not to itself)

  • #4 / Mar 10, 2011 11:04am

    Ian Ebden

    312 posts

    Ah yes, good point! Flying blind here but I’m guessing something like this might work…

    {exp:weblog:entries 
        weblog="courses" 
        disable="categories|member_data|pagination|trackbacks" 
        dynamic="no"
    }
    {if segment_2 != url_title}
    <div class="entry-content">
        {title}
        {g_intro}
    </div>
    {/if}
    {/exp:weblog:entries}

    Replace segment_2 with whichever segment your entries’ url title appears. Give it a whirl.

  • #5 / Mar 10, 2011 11:13am

    marianway

    24 posts

    Thank you again - that has worked.
    😊

  • #6 / Mar 10, 2011 5:47pm

    Sue Crocker

    26054 posts

    Yay! Thanks for the assist, Ian.

    Marianway - Feel free to start a new thread if you have any more questions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases