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.

2
  • 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, 2012 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... Aug 1, 2012 at 18:13

1 Answer 1

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.

2
  • 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!!! Aug 5, 2012 at 4:03
  • Can anybody please help me?? I'm really desperate!!! Aug 9, 2012 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.