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.

Prevent an entry from displaying twice

July 19, 2008 11:50am

Subscribe [4]
  • #1 / Jul 19, 2008 11:50am

    Matt Ansbro

    5 posts

    On my site I have a headline article that displays first.  The headline is defined by a “feature” category and the weblog tag limits this entry to “1” so it only displays the latest entry.  However, not every new entry is a “feature” so they could display out of sequence (not by latest date of entry).  After the headline I want the next 5 articles to display.  The problem I’m running into is the headline article continues to show up in the list.  I tried to use a user-defined variable to strip the headline article out but it’s still showing up.  Can anyone provide some guidance on what I can do to prevent the article from showing up in this list?  My head hurts now.

    Here is the code I have in the template:

    {exp:weblog:entries weblog="news" orderby="date" category_group="1" category="15" limit="1"}
        {if headline_img_up != ""} 
          <div class="headline">
                  <div align="center"><a href="http://{title_permalink=">{exp:png4ie}{headline_img_up}{/exp:png4ie}</a> </div>
          </div>
              {embed="embeds/html_center_tools"}
        {assign_variable:weblog_entry_id="entry_id""}
        {if:else}
          <div class="news_1">
                    <div class="newsThumbnail"><h6>{exp:png4ie}{sub_headline_img}{/exp:png4ie}</h6><p></div>            <br />
                    <div class="newsHeadline"><a href="http://{title_permalink=">{title}</a></div><br />
                    <div class="authorCat"><i>{news_date format='%F %d, %Y '} • By <a href="http://{path=MLS/author}{username}">{author}</a> // Category {categories} • <a href="http://{path=MLS/cat_detail}">{category_name}</a>{/categories}</i></div><br />
                    <div class="newsText">{sub_heading}</div><br />
          </div><br />
         {/if}<br />
       {/exp:weblog:entries}</p>
    
    <p>{exp:weblog:entries weblog="news" orderby="date" sort="desc" limit="5" category_group="1"}  <br />
         {if entry_id!="weblog_entry_id"} <br />
         <div class="news_1"><br />
                    <div class="newsThumbnail"></p><h6>{exp:png4ie}{sub_headline_img}{/exp:png4ie}</h6><p></div>            <br />
                    <div class="newsHeadline"><a href="http://{title_permalink=">{title}</a></div><br />
                    <div class="authorCat"><i>{news_date format='%F %d, %Y '} • By <a href="http://{path=MLS/author}{username}">{author}</a> // Category {categories} • <a href="http://{path=MLS/cat_detail}">{category_name}</a>{/categories}</i></div><br />
                    <div class="newsText">{sub_heading}</div><br />
          </div><br />
          {/if}<br />
    {/exp:weblog:entries}

    The website this renders on is:  MLS Philly 2010

  • #2 / Jul 19, 2008 7:44pm

    Ryan Irelan

    444 posts

    I may be oversimplifying this since I’m not in the thick of the problem and only have this template to go by, but will adding a category parameter to the second weblog entries tag pair to exclude the featured category work? Like this:

    {exp:weblog:entries weblog="news" orderby="date" sort="desc" limit="5" category_group="1" category="not 15"}

    That will keep anything with category 15 (your featured category) showing up in the bottom list. Of course this means you’ll have to change the category of entries that were previously featured.

  • #3 / Jul 21, 2008 7:55pm

    Matt Ansbro

    5 posts

    Thanks Ryan.  I thought of that and the issue is that I want the featured article to show up in the bottom list after it’s done being the feature.  If I just change the category, or create a new one just for the article that should be featured, then it’s back to a manual process.  There has to be a way, via query or some other way, that I can set this up to manage the featured article without it showing up in the list as well.

  • #4 / Jul 22, 2008 5:47am

    Ingmar

    29245 posts

    I think your best option would be to use a custom status of “featured”. In your top section, you limit yourself to this status, in the top section to every oter status (with the possible exception of closed.) Once you change the status from “featured” to “open” (or whatever you choose), the article would automagically “move” from the top to the bottom section. Makes sense?

  • #5 / Jul 22, 2008 7:18pm

    AnotherMuse

    106 posts

    Can you embed the second query within the first, right before the closing weblog tag:

    {embed="embeds/front-news" not_this_entry="{entry_id}"}

    And then in the embedded file run the second weblog query with

    entry_id="not {embed:not_this_entry}"

    as a parameter? Then you shouldn’t have to worry about changing status later.

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

ExpressionEngine News!

#eecms, #events, #releases