1

I created a content type called informational, that has only one field in it, the default body textarea, I added into it <?php echo 'test';?>, and chose the PHP Filter option, in my page--informational.tpl.php all I'm doing is printing that field, and it's printing it as 'plain text' format. I checked in the DB and it's saved as PHP code.

P.S. I'm an administrator of the site, and I have all permissions.

  • if all you are doing is printing the 'value' of the field, that's all you'll get, the actual database contents of the field. if, however, you want to display the filtered version, you'll need to render() it – Jimajamma Aug 1 '12 at 17:36
  • I used render() too, didn't help. I failed to write in my OP that I created a site with Drupal already, so I'm not a total n00b, and I got this kinda stuff to work already, that's why it's really weird... – Shaya Krauss Aug 1 '12 at 18:13
0

If you use print render($content); and your code is displayed as it is on an Informational page ("echo 'test';") you should check PHP code configuration page (?q=admin/config/content/formats/php_code). Here you set the roles who can use this text filter (by default is the 'administrator') and you enable or disable PHP code evaluator. Ensure that 'PHP evaluator' checkbox is on. I hope this will help you.

  • As you can see both in the OP and in my reply to @Jimajamma that I'm an admin, and I used render(). Just to make sure I tried all that you said here, and still no dice, I'm kinda getting desperate!!! – Shaya Krauss Aug 5 '12 at 4:03
  • Can anybody please help me?? I'm really desperate!!! – Shaya Krauss Aug 9 '12 at 14:33

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.