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

Support archive

Using Low Variables in combination with Channel Search Parameters

jjnoldweb 22 Aug 2012 18:34 question, complete

I'm trying to use Low Variables to help with translated URLs.

{exp:channel:entries channel="{segment_1}_market_banner" dynamic="off" search:market_category="{exp:low_variables:single var="gv_{segment_1}_{segment_3}"}"}

Basically I'm storing multiple low variables that have different names but contain the same value. Example gv_en-US_keyword and gv_fr-FR_wordkey would both contain the same value of KEYWORD

I am then trying to use the outputted KEYWORD in the channel entries search parameter to match that up and only pull in the entries that have KEYWORD selected in their market_category custom field. I have tried this with no luck. I have tried turning on early parsing to parse at stage one, have also tried using :parse for stage 5 and have turned parsing off to parse at stage 9. I'm pretty sure the problem is global variables because I tried the following and it works:

{exp:channel:entries channel="{segment_1}_market_banner" dynamic="off" search:market_category="{segment_3}"}

However, with this method I cannot use translated URLs.

Any help is much appreciated, thanks!

Replies

  1. Low 22 Aug 2012 19:57

    Yeah, stage 1 global vars are parsed before segment vars, so composing an early parsed var for input in a tag parameter like that won't work.

    Here's the workaround you're looking for:

    {exp:low_variables:parse} 
    {exp:channel:entries search:market_category="{lv_{segment_1}_{segment_3}}"}
    ...
    {/exp:channel:entries}
    {/exp:low_variables:parse}


    Using the Parse tag without a var="" param will just replace existing vars with their values. So, segment vars first, then the Parse tag (which will replace the LV in the parameter), then the Entries tag.

  2. jjnoldweb 22 Aug 2012 20:16

    Rock on, thanks so much!