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.

EE2.x: Not showing current entry by entry_id

September 15, 2010 1:55pm

Subscribe [5]
  • #1 / Sep 15, 2010 1:55pm

    orionlogic

    18 posts

    I want to show other entries under the same channel except the current entry.

    {exp:channel:entries channel="news" entry_id="not {entry_id}" order_by="random" limit="4" dynamic="no" }

    As you might guess this doesn’t work but you get the idea… All other entries in the channel except current entry. Can i pass this into paramater?

    I may use relationship or categories to relate entries but i just wanted see if this is possible.

    Moved to CodeShare Corner by Moderator

  • #2 / Sep 15, 2010 7:52pm

    Brandon Jones

    5500 posts

    Hi orionlogic,

    When you say hide the ‘current entry’ can you be more specific? Do you mean the latest entry? If so you can specify an offset of 1. Does that help?

  • #3 / Sep 15, 2010 8:28pm

    orionlogic

    18 posts

    Hello Brandon , sorry for my confusing explanation.

    By saying “current entry” i mean current selected entry on that channel, a random selected entry. if i use offset, it will offset from the beginning.

    Lets say i have news channel and have article_1, article_2, article_3, article_4... entries. if i choose article_3 and below the page i want to show other entry names randomly except article_3.

    The thing i am trying to accomplish is that, the channel itself already provides a context for relations between articles so other than using relationships or categories i might randomly show other entries except the current/selected entry.

  • #4 / Sep 16, 2010 10:37am

    Sue Crocker

    26054 posts

    There’s nothing built into EE to do this, but others in the community may have an idea. Moving to CodeShare Corner for additional community support.

  • #5 / Sep 17, 2010 1:39am

    iain

    317 posts

    You can do this by passing the current entry_id into an embed, 

    Very handy when you need to nest channel entries tags.

  • #6 / Sep 17, 2010 1:47am

    iain

    317 posts

    Sorry, guess I should post an example of this…

    So in your single entry view you’d have something like

    {exp:channel:entries channel="articles" limit="1"}
        {title}
        {whatever}
    
        {embed="includes/.other_articles" entry_id="{entry_id}"}
    
    {/exp:channel:entries}

    and then in your includes/.other_articles template

    {exp:channel:entries channel="articles" dynamic="no" entry_id="not {embed:entry_id}"}
    ...

    Hope this helps

  • #7 / Sep 28, 2010 5:15am

    orionlogic

    18 posts

    Sorry iain , i havent received email notification for thread update so i didn’t see your suggestion.

    It worked perfectly, as i expected. thanks a lot!

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

ExpressionEngine News!

#eecms, #events, #releases