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.

Conditional Statement for Multi-Month Events

June 17, 2011 2:13pm

Subscribe [2]
  • #1 / Jun 17, 2011 2:13pm

    briankalwat

    50 posts

    Hey Friends,

    I have a channel on a site that contains start & end date custom fields for a calendar. I’m listing the dates in my template and I’m trying to figure out the logic to show the end date’s month only if it differs from the start day’s month.

    For instance,

    May 5-15
    June 29-July 5

    Here’s what i’m thinking, (but it’s not working). It’s a multi-conditional that shows the end date if it’s available, but i’m having trouble figuring out the logic to check to see if the months match between entry_date & event_enddate. Thoughts?

    {entry_date format="%M %j"}{if event_enddate}-{if entry_date format="%M" != event_enddate format="%M"}{event_enddate format="%M"} {if:else}{/if}{event_enddate format="%j"} {if:else}{/if}
  • #2 / Jun 17, 2011 3:12pm

    {entry_date format="%M %j"} -
    
    {if {entry_date format="%M"} != {event_enddate format="%M"}}
        {entry_date format="%M %j"}
    {if:else}
        {entry_date format="%j"}
    {/if}

    I don’t recall if the {entry_date}‘s need to be in quotes when formatted and in conditionals… if they do, you may need this:

    {entry_date format="%M %j"} -
    
    {if "{entry_date format='%M'}" != "{event_enddate format='%M'}"}
        {entry_date format="%M %j"}
    {if:else}
        {entry_date format="%j"}
    {/if}
  • #3 / Jun 18, 2011 11:07am

    Greg Salt

    3988 posts

    Hi Brian,

    Did PressEnter’s solution help you out with this?

    Cheers

    Greg

    @PressEnter, thanks for the help.

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

ExpressionEngine News!

#eecms, #events, #releases