Problem with Include

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In an effort to clean up some code, I tried taking four lines out of 6 or 7 programs and putting them into an include file. The file structure is

Root
  data
    clubs.php
  include
    fmt.inc

Originally, clubs.php had the following code:

<?PHP
$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print("This page last modified ");
print(date("m/j/y", $last_modified));

?>

This code works - on the web page I get

This page last modified 12/18/2010

which is correct.

So then I did the following:
Create an include file, fmt.inc with the following code:

$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print("This page last modified ");
print(date("m/j/y", $last_modified));

and then in the original file, I have

<?PHP
include "../include/fmt.inc";
?>

On my web page, I then get

$file_name= basename($_SERVER['PHP_SELF']);$last_modified = filemtime($file_name);print("This page last modified "); print(date("m/j/y", $last_modified));

(all on one line).

I would really like to understand why the include construct doesn't give the same results as the original?

     -----===== Bill =====-----

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux