Author Topic: Including PHP Code  (Read 3626 times)

0 Members and 1 Guest are viewing this topic.

Offline Dan1113

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Including PHP Code
« on: February 23, 2003, 08:55:41 PM »
Hi everyone,

I want to put a PHP stats tracker on my gallery. However, I can't put the php code for it in a template (since it's .html) and I don't know how to go about putting it in the default php header or footer.

(It's a php include.)

Any ideas?

Thanks. :)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Including PHP Code
« Reply #1 on: February 23, 2003, 08:58:22 PM »
Just put the include in the html templates like this:
Code: [Select]
<?php 
include&#40;$_SERVER['DOCUMENT_ROOT'&#93;."/relative/path/to/my/include.php"&#41;; 
?>

And open includes/constants.php to set
Code: [Select]
// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 0);

to this
Code: [Select]
// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 1);


Also be sure to read the FAQ forum topic:
http://4homepages.de/forum/viewtopic.php?t=3378

Offline Dan1113

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Including PHP Code
« Reply #2 on: February 23, 2003, 09:06:07 PM »
It worked - thanks! :)