0

Trying to create the following redirect template for some structure pages, however the url is outputting like this http://example.com/{site_url}#section. Any idea why {site_url} variable isn't working? And/or any idea how to resolve issue. Thanks in advance.

{exp:channel:entries channel="pages"}
    <?php
        header( "Location: {site_url}#{homepage_section}" );
        exit;
    ?>
{/exp:channel:entries}

1 Answer 1

0

You have PHP set to input on this template. That means that that something like:

<?php
    $test = "{site_url}";
?>

Causes the template parsing engine to eval the raw PHP code before replacing {site_url} with the actual site URL. You need to set PHP to output for this template, which means that EE template tags get parsed FIRST, then it evals the PHP code, meaning the above will look like this by the time the raw PHP gets executed:

<?php
    $test = "http://www.domain.com";
?>

Soooo yeah. FYI, if you have PHP on that template in other places, switching from input to output could definitely break things.

Edit

Wait.. so one EE tag is getting parsed, but the other isn't?

1
  • The templates are already set to output. And yes, the {homepage_section} variable is parsing, but not the global variable, {site_url}. Any idea? Commented Aug 27, 2015 at 15:26

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.