ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using Global Variables in combination with Channel Search Parameters

August 22, 2012 3:00pm

Subscribe [1]
  • #1 / Aug 22, 2012 3:00pm

    jj.nold

    2 posts

    I’m trying to use Global Variables to help with translated URLs.

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

    Basically I’m storing multiple global 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 can get it to work by just using the segment but I need the global variables for this method to work completely.

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

    I’ve also tried relationships but can’t use that because I am reusing field groups across multiple channels but can only relate the field group to one channel.

    I am open to other methods of execution but thus far, the one I’ve listed is the cleanest method.

    All help is greatly appreciated. I’m not sure if this is in the right support category.

  • #2 / Aug 23, 2012 12:34pm

    Dan Decker

    7338 posts

    Hi jj.nold,

    Thanks for posting your question!

    The problem here is ExpressionEngine’s Parsing Order. The segment variables are being rendered, then the channel entries tag is executed, then your User Defined Global Variables are rendered.

    I suggest a look at Transcribe or Low Variables as a way to work around this. Transcribe is a multilingual add-on and Variables can “jump the line” in the parsing order to be rendered earlier.

    ~

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases