And, you can even do this automatically using the auto_prepend_file and auto_append_file settings:

http://us3.php.net/manual/en/configuration.directives.php

These can be set in your Apache config file, php.ini or .htaccess, so you can control what files are used down to the lowest subdirectory level.

Of course, if you need to include() in the middle of a page, or conditionally include files, these won't work -

steve


At 5:16 AM -0800 1/14/04, Freedomware wrote:
Wow, that is a lot simpler than I imagined. Thanks for the tip!


Jay Blanchard wrote:


[snip]
I thought this would be the easiest thing to learn, but I'm striking out

right and left. I bought a book about PHP, but the includes examples don't work for me at all. I searched several forums and www.php.net, but

it's hard to even zero in on a good tutorial.
[/snip]

http://www.php.net/include

There is no tutorial for this because it is painfully simple to use.
Create toBeIncluded.php --

<?php
$todayDate = date("m-d-Y");
?>

<h1>Today is <?php echo $todayDate; ?></h1>

You're all done!

Now create myIncluded.php --

<html>
<head></head>
<body>
<h1>Welcome!</h1>
<?php

inlclude("toBeIncluded.php");

?>
</body>
</html>

All done! Now just place these files in the same directory in your web
server and load myIncluded.php from the browser. You may have to pay
close attention to the paths of the files, but it is pretty simple
really.

HTH!

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


--
+------------------------------------------------------------------------+
| Steve Edberg                                      [EMAIL PROTECTED] |
| University of California, Davis                          (530)754-9127 |
| Programming/Database/SysAdmin               http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| [EMAIL PROTECTED]: 1001 Work units on 23 oct 2002                              |
| 3.152 years CPU time, 3.142 years SETI user... and STILL no aliens...  |
+------------------------------------------------------------------------+

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



Reply via email to