I’ve had a wordrpress site working for about 2 years using a pluggin called Inline PHP. This is a shortened version that used to work:
<exec>
$levels = array('Level 3','Level 1','Level 2');
if (in_array("Level 3", $levels)) {
echo "<script language=javascript>getlevel('http://www.my-site.com/my-training/level-3/')</script>";
}
</exec>
This no longer works, and I can’t figure out why.
I’ve tried each component individually:
<exec>
$levels = array('Level 3','Level 1','Level 2');
echo implode(' ', $levels);
</exec>
writes the correct array entries, and
<exec>
$levels = array('Level 3','Level 1','Level 2');
if (in_array("Level 3", $levels)) {
echo "yes";
</exec>
returns ‘yes’ (and no if I make the conditional fail), and finally:
<exec>
echo "<script language=javascript>getlevel('http://www.my-site.com/my-training/level-3/')</script>";
</exec>
redirects to the level-3 page as expected..
The problem seems to be when I am nesting the javascript in the if conditional and it’s just staying on that page – and not rendering anything on the page.
ANY help, would be greatly appreciated
So, it successfully prints
<script language=javascript>getlevel('http://www.my-site.com/my-training/level-3/')</script>
to the screen but the page doesn’t redirect as expected?This seems to be a problem with the getlevel function. Press 12 and see if there are any console errors.