expressionEngine php parsing str_replace not working -
i have template php enabled on output. can't str_replace work. see below code. if put {title} without php works. when include php , place {title} inside str_replace function, nothing displayed. tried php simple echo 'test'; , worked. it's not parsing {title} or other field tags.
{exp:channel:entries channel="one" url_title="{segment_2}"} <?php echo str_replace('old', 'new', '{title}'); ?> {/exp:channel:entries}
this may sound preposterous, have tried removing url_title
parameter {exp:channel:entries}
tag ensure rest of code , logic working properly?
the following code should output entry title of "old test" (without quotes):
{exp:channel:entries channel="channel_name" entry_id="xx" dynamic="off"} {title} {/exp:channel:entries}
given same entry title of "old test", should output: "new test" (again, without quotes):
{exp:channel:entries channel="channel_name" entry_id="xx" dynamic="off"} <?php echo str_replace('old', 'new', '{title}'); ?> {/exp:channel:entries}
this tested in new, blank template php enabled , set output.
Comments
Post a Comment