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.

Listing too many entries on single entry page

July 26, 2012 4:11pm

Subscribe [3]
  • #1 / Jul 26, 2012 4:11pm

    alettieri

    3 posts

    I’m having a channel:entries issue with one of my sites. This happens spuraticaly.

    I created a channel called ‘projects’.

    When viewing a single project entry, for example /projects/entry_title, the page lists out all project entries rather than the single entry.

    I use a conditional statement to determine wether to display html for a single entry or multiple entries:

    {exp:channel:entries channel="projects" status="published" disable="member_data|pagination" }
           
    {if total_results > 1 || segment_2 == ""}
    // display multiple entries
    {if:else}
    // display single entry
    {/if}

    I am caching the template file, clearing the cache resolves the issue. However, after some time the issue crawls back up.

    Any ideas, suggestions are much appreciated.

     

  • #2 / Jul 27, 2012 10:36am

    Boyink!

    5011 posts

    So the template is designed to display single and multiple entries?  And even when your URL has a valid url title from one entry in it it’s displaying multiple?

    I’d try breaking up your conditional into two separate conditionals, and putting your channel entries loop within it.  This way you can take advantage of some additional parameters that help ensure proper results:

    {if segment_2 ==""}
    {exp:channel:entries channel="projects".....
    stuff
    {/exp:channel:entries}
    {/if}
    
    {if segment_2 !=""}
    {exp:channel:entries channel="projects" limit="1" require_entry="yes"}
    stuff
    {/exp:channel:entries}
    {/if}
  • #3 / Jul 27, 2012 3:58pm

    Kevin Smith

    4784 posts

    Excellent, Mike. alettieri does that help?

  • #4 / Jul 29, 2012 9:12pm

    alettieri

    3 posts

    So the template is designed to display single and multiple entries?  And even when your URL has a valid url title from one entry in it it’s displaying multiple?

    I’d try breaking up your conditional into two separate conditionals, and putting your channel entries loop within it.  This way you can take advantage of some additional parameters that help ensure proper results:

    Yes, that’s my problem exactly. Thank you very much, I’ll work in the suggested changes and will reply with the results!

     

  • #5 / Jul 30, 2012 5:14pm

    Shane Eckert

    7174 posts

    Hey alettieri,

    I am glad that Mike and Kevin were able to help!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases