I'm using Mo' Variables for the early-parsed request variables. Here is the best-case scenario:
{exp:calendar:cal
date_range_start="{if get:start}{get:start}{if:else}today{/if}"
date_range_end="{if get:end}{get:end}{if:else}6 months{/if}"
}
This obviously doesn't work do to advanced conditionals being parsed late (sigh). So here is the workaround I thought might work:
{exp:calendar:cal
date_range_start="{if get:start != ''}{get:start}{/if}{if get:start == ''}today{/if}"
date_range_end="{if get:end != ''}{get:end}{/if}{if get:end == ''}6 months{/if}"
}
This doesn't work either. After doing a bit of debugging, it appears that the conditionals are not being parsed. My guess is that this is because there is no query string variable called "start" when the user first visits the page so the template parser doesn't find the conditional until later in the parse order.
I can make this work with PHP, but I'd love to have a pure EE solution:
{exp:calendar:cal
date_range_start="<?= !empty($_GET['start']) ? $_GET['start'] : 'today' ?>"
date_range_end="<?= !empty($_GET['end']) ? $_GET['end'] : '6 months' ?>"
}
So my question is this: is there an elegant solution to---without using PHP in my template---get the value of a request variable and if it doesn't exist use some default value? There must be some trick I'm not seeing to make this work. I don't think using Switchee or IfElse will be elegant here. It will work, but it would look really janky and make the calendar module tag hard to read. I'll concede defeat and drop down to PHP before doing that.