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.

2 weblog entries tags w/in if?

September 24, 2009 5:38pm

Subscribe [4]
  • #1 / Sep 24, 2009 5:38pm

    nessnzoe

    62 posts

    hi all,

    i’m trying to return entries from two different weblog categories (same blog) within a single if:elseif statement. can i not do this? here’s the code:

    {exp:weblog:entries weblog="board_bulletins" category="25"}
    <h1>{title}</h1>
    {bod_body_copy}
    {/exp:weblog:entries}
    
    <h2>Meeting Materials by date:</h2>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="29"}<br />
    <a href="http://{title_permalink=board_bulletins/index}" title="{title}">{title}</a><br />
    {/exp:weblog:entries}

    it fails on this page: http://www.fchealth.org/index.php/board_bulletins/fch_board/ when it’s contained within an if/if:else

    {if segment_1 == 'board_bulletins' AND segment_2 == ''}
    
    {exp:weblog:entries weblog="board_bulletins" entry_id="94"}
    <h1>{title}</h1>
    {bod_body_copy}
    
    {/exp:weblog:entries}
    
    {if:elseif segment_1 == 'board_bulletins' AND segment_2 == 'fch_board'}
    
    {exp:weblog:entries weblog="board_bulletins" category="25"}
    <h1>{title}</h1>
    {bod_body_copy}
    {/exp:weblog:entries}
    
    <h2>Meeting Materials by date:</h2>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="29"}<br />
    <a href="http://{title_permalink=board_bulletins/index}" title="{title}">{title}</a><br />
    {/exp:weblog:entries}</p>
    
    <p>{/if}

    but works here: http://www.fchealth.org/index.php/board_bulletins/test/ without the if/if:else.

    any ideas?

    thanks,
    vanessa

  • #2 / Sep 24, 2009 8:01pm

    lebisol

    2234 posts

    how about {if:else ....
    or just use 2 if conditions.
    {if A then…
    {/if}
    {if B then….
    {/if}

  • #3 / Sep 25, 2009 3:19am

    John Henry Donovan

    12339 posts

    nessnzoe,

    Using lebisol’s approach of simple conditionals should do the trick for you. let us know how you get on.

  • #4 / Sep 25, 2009 3:00pm

    nessnzoe

    62 posts

    hi guys,

    unfortunately i’m trying to get both category 25 and category 29 to appear so it’s not really either this or that. it’s if the segments are A and B show BOTH this category and that category. it works outside the conditional, just not within.

    oh…wait! i think i get it. you’re saying scrap the if:elseif’s all together? just use if /if; if /if…right? i’ll give it a go. there’s actually five of these, but if they’ll work within simple conditionals i’ll be mondo joyous!

    i’ll let you know if it works.

    THANKS!
    vanessa

  • #5 / Sep 25, 2009 3:04pm

    nessnzoe

    62 posts

    well, shoot. no go. i tried:

    {if segment_1 == 'board_bulletins' AND segment_2 == ''}
    
    {exp:weblog:entries weblog="board_bulletins" entry_id="94"}
    <h1>{title}</h1>
    {bod_body_copy}
    
    {/exp:weblog:entries}
    {/if}
    
    {if segment_1 == 'board_bulletins' AND segment_2 == 'fch_board'}
    
    {exp:weblog:entries weblog="board_bulletins" category="25"}
    <h1>{title}</h1>
    {bod_body_copy}
    {/exp:weblog:entries}
    
    <h2>Meeting Materials by date:</h2>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="29"}<br />
    <a href="http://{title_permalink=board_bulletins/index}" title="{title}">{title}</a><br />
    {/exp:weblog:entries}<br />
    {/if}</p>
    
    <p>{if segment_1 == 'board_bulletins' AND segment_2 == 'executive_committee'}</p>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="26"}<br />
    <h1>{title}</h1><br />
    {bod_body_copy}</p>
    
    <p>{/exp:weblog:entries}</p>
    
    <h2>Meeting Materials by date:</h2>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="30"}<br />
    <a href="http://{title_permalink=board_bulletins/index}" title="{title}">{title}</a><br />
    {/exp:weblog:entries}<br />
    {/if}</p>
    
    <p>{if segment_1 == 'board_bulletins' AND segment_2 == 'finance_committee'}</p>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="27"}<br />
    <h1>{title}</h1><br />
    {bod_body_copy}</p>
    
    <p>{/exp:weblog:entries}</p>
    
    <h2>Meeting Materials by date:</h2>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="31"}<br />
    <a href="http://{title_permalink=board_bulletins/index}" title="{title}">{title}</a><br />
    {/exp:weblog:entries}<br />
    {/if}</p>
    
    <p>{if segment_1 == 'board_bulletins' AND segment_2 == 'governance'}</p>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="28"}<br />
    <h1>{title}</h1><br />
    {bod_body_copy}</p>
    
    <p>{/exp:weblog:entries}</p>
    
    <h2>Meeting Materials by date:</h2>
    
    <p>{exp:weblog:entries weblog="board_bulletins" category="32"}<br />
    <a href="http://{title_permalink=board_bulletins/index}" title="{title}">{title}</a><br />
    {/exp:weblog:entries}</p>
    
    <p>{/if}

    fails silently with nothing being passed after the Meeting Materials H2. i might not fight this…just create separate templates for each page. i’ll let you know if that works!

    v.

  • #6 / Sep 25, 2009 3:07pm

    nessnzoe

    62 posts

    that worked…separate templates. not very elegant, but i’m not enough of a programming sophisticate at this point to do much about it.

    thanks again for pointing me in a direction that helped me solve the issue.

    best,
    v.

  • #7 / Sep 25, 2009 4:54pm

    Sue Crocker

    26054 posts

    Glad you were able to figure out what the problem was. Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases