1

Here is my code in a snippet. Basically what low_replace does is just to convert spaces to dashes.

{exp:low_replace find="SPACE" replace="-"}
    {permalink="product"}/
    {field_a}-
    {related_entries id="foo"}
        {foo_name}
    {/related_entries}
    -{field_b}
    {if bar != ''}-{bar}{/if}
    {related_entries id="test"}-
        {test_name}
    {/related_entries}/
{/exp:low_replace}

When I tried it, I got this error

Parse error: syntax error, unexpected T_STRING in /home/test/public_html/system/expressionengine/libraries/Functions.php(683) : eval()'d code on line 1

Any idea why this is the case?

2

Parse order strikes again. The conditional inside the tag is an advanced one and will be parsed after all the tags. That means it is still present when the replace tag is processed, creating code like this:

{if-bar-!=-''}-{bar}{/if}

Which is likely to cause the template parser to choke when it tries to parse it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.