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.

Entry Date IF Statement

November 12, 2012 6:14pm

Subscribe [1]
  • #1 / Nov 12, 2012 6:14pm

    khowe

    12 posts

    Hi, I am trying to figure out an IF statement based on Expiration and Entry dates but it doesn’t seem to be working.

    here is what we have to start

    <h3> {entry_date format="%F %d"} - {expiration_date format="%d, %Y"}</h3>

    This works great to show an event span such as Nov 15 - 25, 2012. However, what if an event spans two months, for example January 28 - February 3rd. In order to do this my thought is to check if the months match for the expiration_date and the entry_date and then display a different date.

    {if '(expiration_date format="%F"}' == '{entry_date format="%F"}'}
    Entry Month's Match Display Here
    {/if}

    This IF statement produces a “Parse error: syntax error, unexpected T_STRING” error. What am I missing? I see the same syntax as a sample on this post: http://ellislab.com/expressionengine/user-guide/templates/date_variable_formatting.html#12935

     

  • #2 / Nov 14, 2012 5:01pm

    Dan Decker

    7338 posts

    Hi khowe,

    Give it a try without the single quotes.

    {if {expiration_date format="%F"} == {entry_date format="%F"}}
    Entry Month's Match Display Here
    {/if}

    Let me know the result of that.

    Cheers,

  • #3 / Nov 14, 2012 6:14pm

    khowe

    12 posts

    Yeah, that’s where I started and it was not happy.

    Parse error: syntax error, unexpected T_IS_EQUAL in .../sia-admin/expressionengine/libraries/Functions.php(680) : eval()‘d code on line 11

  • #4 / Nov 16, 2012 3:38pm

    Dan Decker

    7338 posts

    I’d like to take a look. Keep an eye out for an email from EllisLab!

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases