Problem with DropDate and Conditional (set to early parsing)
I have a problem with a conditional I'm using to test for date. I'm using Low Variables 2.2.1 along with the DropDate addon (although the problem persists when I change to a text input with the same integer).
entry open {control_entry_open}, current_time {current_time format="%Y%m%d"}
will render out as:
entry open 20120604, current_time 20120523
My actual condition though which works if I hardcode the above dates does not work.
{if '{control_entry_open}' > '{current_time format="%Y%m%d"}'} show {if:else} don't show {/if}
Variations with/without statements and quotes give a similar problem.
Any ideas what could be causing the problem?
Replies
Brendan Underwood 23 May 2012 10:03
{if 20120604 > 20120523} show {if:else} don't show {/if}
returns the correct intended outcome - 'show'.
as does
{if '20120604' > '20120523'} show {if:else} don't show {/if}
Low 23 May 2012 10:18
Can't seem to reproduce. What are the settings for the DropDate var type? Are you sure it is saving the date as YYYYMMDD?
Low 23 May 2012 10:21
Looks like it is, eh? Can I get access to the CP, perhaps? Maybe it's environmental.
Brendan Underwood 23 May 2012 10:28
CP details sent.
Low 23 May 2012 10:41
Hey Brendan,
The early parsed vars weren't getting added to the Snippets array, because a hook was missing in the exp_extensions table. Somehow, it must have slipped through the upgrade process from EE1 to EE2.
Anyway, I added the hook to the DB, so now it works again.
Brendan Underwood 23 May 2012 11:18
Cool, thanks very much for the quick support. I did honestly think I was going mad.
Brendan Underwood 4 Jun 2012 12:36
Hi Low, sorry but having some problems with DropDate addon again. Although I'm able to use the variable name itself {control_entry_open} fine, as soon as I add in a format parameter, it just renders the tag code itself, not the formatted date. e.g.
{control_entry_open format="%l, %j %F %Y at %g:%i%A"}
or
{control_entry_open format="%Y"}
Any ideas why it's not working? Note that I've switched between using the UNIX Timestamp and YYYYMMDD format on how the variable stores the data.
Low 4 Jun 2012 12:38
Snippets/Global variables can't have parameters, so you'd have to use the template tag instead:
Brendan Underwood 13 Jun 2012 12:57
Low, wondering if the problem with my disappearing hooks on the web awards website could have been caused by Profile:Edit. Using on another website where saving the P:E settings blows away one of the hooks out of exp_extensions table.
http://mightybigrobot.com/forums/view...
Brendan Underwood 13 Jun 2012 13:23
And now Rob has provided a fix too.
Low 13 Jun 2012 13:31
Ah, good to hear!