1

In Shortlist the {exp:shortlist:view} tag extends the channel->entries() method for it's parsing needs. This works and allows for full custom tag parsing without much extra effort, but runs into issues when formatting extra date variables.

In the view loop we provide an extra variable {entry_real_date} which is the actual date for the entry (vs. the date it was added to a list). The parser never see's our custom variable as a date variable, so ignores any format param.

ie :

{entry_real_date format="%n %Y"}

is never parsed.

In a normal situation where we're applying our own tag parsing, we'd be able do something like :

$tagdata = ee()->TMPL->parse_date_variables($tagdata, $dates);

but with in the channel->entries() usage we can't get access to the raw parsing to do this. The parser does look for custom date variables, but only within the context of custom fields, so our dynamically attached variable is never handled.

From digging I can find no way to mark our custom variable as a date variable to enable that format parsing.

Has anyone run into this and handled it?

This is on EE2.8+

2
  • Which version of EE? Commented Oct 20, 2014 at 10:59
  • 2.8+. (updated the question) Commented Oct 20, 2014 at 11:40

1 Answer 1

1

My pragmatic solution would be to just enable PHP on output.

2
  • Agreed; <?php echo strftime("%m/%Y" , intval("{entry_real_date}")); ?> seems to do the trick. Commented Oct 20, 2014 at 19:48
  • 1
    That works as a hacky work around and I'll add a note to the docs about it, but it would be good if there was a way to get the template parser to pick it up as a valid date field. Commented Oct 20, 2014 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.