I have a multilingual site, with one channel and multiple fields for different languages. The site has 20+ different channels. Everything works ok, except the search results page for low_search in 2. language.

The problem is with the creation of entry urls for search results (there are several different channels in serach results)

In other templates i generate the url with code


I tried to find out in wich channel the result entry is, and then store his group name in preload_replace var. But that is not working properly. Every entry gets the group name of the first item in IF. The used code:

{if low_search_no_results}                      
    <div class="alert alert-success">
        No results found for the search term

{if channel_name == "kontakt"} {preload_replace:my_template_group="contact/"}{/if}
{if channel_name == "o-nama"} {preload_replace:my_template_group="about-us/"}{/if}                  
{if channel_name == "vijesti"} {preload_replace:my_template_group="news/more/"}{/if}                        

<h2 class="entry-title-index">
    <a  href="{path='{my_template_group}'}/{entry_id}/{exp:create_url_title}{title-en}{/exp:create_url_title}" 

I tried the if with channel_name ,channel_id, channel_short_name...I always get the same result (my_template_group=contact)

It would be a good idea to store the group name in a variable, as I use the generated url in multiple places (img href, h2 title...)

1 Answer 1


I'm not sure what the limitations of your templates are, or what version of EE you are using but a couple of suggestions:

First, a low impact way of storing interim results is to use layout variables - these are defined easily and become available for reuse in your templates when processing transfers to the next template in the sequence. So you could temporarily save your template group into a layout variable, transfer to a second layout template and use that value where ever etc. So something like this...

First template in build

{layout='next_layout_in_build'} {!-- transfers processing to this template next --}

{layout:set name="template_group"}
   ...put your code to choose template group here...

Second template in build (in this case 'next_layout_in_build.html' in same template folder as first)

<a  href="{path='{layout:template_group}'}/...

Whether this helps of course depends on what actually you are doing.

Second, you can drop use of exp:create_url_title - the Variable Modifiers feature now lets you do this via the :url_slug modifier.


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.