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.

Related entries showing the current entry only

March 26, 2011 7:55pm

Subscribe [3]
  • #1 / Mar 26, 2011 7:55pm

    cmscss

    144 posts

    Hi There,

    I’ve had this working on other sites (EE 2.1.2 admitidly) so thought I understood related categories mode but am having trouble with a new site running EE 2.1.3.

    At the bottom of my news item page I have a related entries section with the following the code:

    <!-- START RELATED NEWS -->
    <div>
    <h3>Related articles:</h3>
    
    <p><!-- start related news items --><br />
    {exp:channel:entries dynamic="no" channel="news_items" related_categories_mode="yes" limit="6" custom_fields="yes"}</p>
    
    <p><div class="c4"></p><h4><a href="http://{page_url}">{title}</a></h4>
    <p>{news_introtext}<br />
    <a href="http://{page_url}" class="button sml">Read full story</a><br />
    </div><br />
    {/exp:channel:entries}</p>
    
    <p>{if no_results}<br />
    There are crrently no articles related to this news item.<br />
    {/if}<br />
    {/exp:channel:entries}<br />
    </div><!-- end related news -->

    The right number of related entries appear but they’re all just duplicates of the current news item and link to the current news item’s page.

    Not sure what I’ve missed sorry - all the entries are tagged with the correct category etc.

    Any help would be much appreciated.

    Cheers

    Ben

  • #2 / Mar 27, 2011 1:04am

    MDB

    83 posts

    Try this and see if it works.  I think you have one too many closing tags for {/exp:channel:entries}

    <!-- START RELATED NEWS -->
    <div>
    <h3>Related articles:</h3>
    
    <p><!-- start related news items --><br />
    {exp:channel:entries dynamic="no" channel="news_items" related_categories_mode="yes" limit="6" custom_fields="yes"}<br />
    {if no_results}<br />
    There are currently no articles related to this news item.<br />
    {/if}<br />
    <div class="c4"></p><h4><a href="http://{page_url}">{title}</a></h4>
    <p>{news_introtext}<br />
    <a href="http://{page_url}" class="button sml">Read full story</a><br />
    </div><br />
    {/exp:channel:entries}</p>
    
    <p></div><!-- end related news -->

  • #3 / Mar 27, 2011 3:47pm

    cmscss

    144 posts

    Actually I had it in the wrong place and it needed to be moved up - thanks!

  • #4 / Mar 28, 2011 9:57am

    Sue Crocker

    26054 posts

    Thanks for the assist, Ethereal.

    cmscss - 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