php in pages does not accept variables from outside the post
-
Hello everyone,
I use the php-exec plugin to run php inside pages and posts.I have some code inside my custom theme in header.php
<?php ... ... $flag = 1; ?>
Inside a page, using the HTML editor, I insert something like this:
<?php if ($flag == 1){ echo 'It works'; } else{ echo 'No, it does not'; } ?>
After I save my page and go to the site to see the results, it reads “No, it does not”, which is wrong because $flag = 1 in the header!
That means that the php code inside the post can’t interact with the php code outside the post, in this example, in the header.php!
Any ideas? I tried global $flag; in the header.php but still no luck.
Thanks in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘php in pages does not accept variables from outside the post’ is closed to new replies.