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.

Homepage News section pulling from multiple weblogs

April 19, 2010 1:20am

Subscribe [2]
  • #1 / Apr 19, 2010 1:20am

    natis

    3 posts

    Hello all. I have a site that has 3 weblogs: inner-page, news, and events. Each weblog (through Gypsy) has a drop down field to denote if a new entry should be posted on the homepage. The code for the news section is:

    {exp:weblog:entries weblog="inner-pages|news|events" limit="3"
    disable="categories|member_data|pagination|trackbacks|category_fields" dynamic="off" orderby="date"} 
    <li> 
    
        {if home-news-blurb !="" && in-whats-new != "No"}
            <a href="http://{page_uri}"><span>{title}</span>__        <strong>{home-news-blurb}</strong>__   _    {if:elseif lead-in !="" && in-whats-new != "No"}_        <a href="{page_uri}"><span>{title}</span>__        <strong>{lead-in}</strong>___    {if:elseif event-lead-in !="" && in-whats-new != "No"}_        <a href="{page_uri}"><span>{title} _        {if event-date !=""}({event-date format="%F %j, %Y"} - {event-time}){/if}</span>__        <strong>{event-lead-in}</strong>___    {/if}__    <span class="more">More »</span></a></li>
    {/exp:weblog:entries}

    It mostly works as expected but there is one issue that I’m running into. If a new entry is created and the in-whats-new field is set to “no”, the order is pushed down (as expected) but then the first entry appears blank.

    To illustrate, prior to a new entry with “no” selected as to whether or not to show on the homepage, the news looks like:

    - Item 1 More »
    - Item 2 More »
    - Item 3 More »

    If a new entry is added and the “no” option is selected, you see

    - blank More »
    - Item 1 More »
    - Item 2 More »

    Part of me feels like I may be overlooking something obvious but any assistance is greatly appreciated.

    Thank you.

  • #2 / Apr 19, 2010 8:38pm

    Omkar N.

    177 posts

    The reason you are getting the ‘blank’ is because the ‘No’ option is selected and so none of the if statements are met.  The More link is outside the if statement so it is still displaying.  The way you are using the weblog entries tag, you are getting 3 results.. it’s just that one of the results has ‘No’ selected.

    I think what you are trying to do is get the top 3 results that do not have ‘No’ selected for that option.

    One way for doing so may be via the Query module:
    http://expressionengine.com/docs/modules/query/index.html

  • #3 / Apr 22, 2010 2:20am

    natis

    3 posts

    Hi Triom,

    Thanks for the lead. I didn’t want to let you think I ignored this thread. Will do a bit of research over the weekend and see how that goes and will let you know.

    Thank you once again.

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

ExpressionEngine News!

#eecms, #events, #releases