Search code examples
phptemplatescontent-management-systemexpressionengine

Global variable not being parsed inside related_entries tag


I've got two channels that are related. The website is multilingual and the {lang} global variable contains the language (en / nl / de / fr).

Using the {{lang}-something} approach works throughout the whole site, but not within the related entries tag.

The output of {{lang}-something} should be the content, but it literally is {en-something}. So the language is inserted but it's not being parsed after that.

When I simply use {en-something} in the template (without dynamically setting the language) I do get the content.

Template snippet:

{related_entries id="product_usp_1"}
    <div class="ups_item">
        <h3>{{lang}-usp-title}</h3>
        <p>{{lang}-usp-content}</p>
    </div>
{/related_entries}

Any suggestions? Thanks in advance!


Solution

  • I'm not entirely sure why, but this works:

    <h3> {<?php echo '{language}';?>-usp-title}   </h3>
    <p>  {<?php echo '{language}';?>-usp-content} </p>
    

    This code is insite the related_entries tag, not embedded.

    PHP Parsing stage: input