All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

{current_time} not parsing in tag in Low Variables

James 30 Dec 2013 04:14 problem, rejected

I have a textarea Low Variable with early parsing enabled. Inside that variable I have a channel entry tag that uses the {current_time} EE variable to set the start_on parameter. It looks like this:

{exp:channel:entries channel="webinars" dynamic="off" show_future_entries="yes" start_on="{current_time format='%Y-%m-%d %H:%i'}"}

That LV is put in a channel entry in a Wygwam field like so: {exp:low_variables:parse var='lv_webinars_en'}.

The channel entries tag renders, but not quite with the results I was expecting. When I look at the template debugger I see that the {current_time} variable is not actually rendering before the entries tag is running. I did test my entries tag (without any Low Variables) in a dummy template and it did run correctly, so I know that it should work. So it looks like I am running into a parse order problem. So is there a way that I can get the current time inserted into the start_on parameter?

Replies

  1. Low 30 Dec 2013 08:02

    Correct, this is due to the nature of EE's parse order. See also this blog post: http://gotolow.com/blog/parse-order-a...

    You either need to use the variable syntax with early parsing, or use the preparse:-parameters with the tag syntax. Note that early parsing is irrelevant when using he tag syntax.

    In your case, you could use something like:

    {exp:low_variables:single var="lv_webinars_en" start_on="{current_time format='%Y-%m-%d %H:%i'}"}


    This should work if the tag is as is, directly in the template. If the tag is inside something else, like your Wygwam content, then you might still see the parse order issue.

  2. James 30 Dec 2013 08:29

    So if I want to keep the LV tag inside of a Wygwam entry field rather than directly in a template is there no way to insert that {current_time}? It is sounding like that might be the case.

    I always have the dreaded {embed} as a fallback. I'd just really prefer not to use it.

  3. Low 30 Dec 2013 08:35

    Well, it's how parse order works, see: http://gotolow.com/parse-order

    The {current_time} var is parsed early, before tags are parsed, and therefore before any of the Wygwam fields are processed.

  4. James 30 Dec 2013 08:45

    ok... i guess i have to use an EE embed for that. I was just hoping to use LV for that. I just hate the overhead that embeds have.

    That is one area I have noticed can be a little tricky with LV is when you want to do a lot of nesting of tags. Not really a knock on anything you have done. You of course have to work within the parameters of EE.

    Thanks for looking at this!