Hi,

The best way to do this (it's only my opinion, I'm sure there are many other
ways but this way works for me) is to create a .php file and fill it with
your most commonly used functions. You can use a .inc file, which is
probably recommended, but you will need to tell the server not to display
this file. You can do this in php.ini but it will complicate things right
now.

For a header, use a function name like drawHeader() or something and then
put all your database connection, navigation, page formatting etc in that
function.

Then, on all your pages, you just need to add the following at the top.

<?
include("yourincfile.php");
drawHeader();
?>

This will draw you header the same on all pages that you include the above
with. If someone navigates to yourincudefile.php all they should see is an
empty page because all the code is inside functions.

Hope this helps
Andy.


----- Original Message -----
From: "Rick Beckman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 07, 2002 11:12 AM
Subject: [PHP] Includes


> I'm wanting to use PHP to make updating an entire site easier by using
> include() [I think that's the function] to include navigation bars,
notices,
> etc. on multiple pages. What's the best way to do that, and is it possible
> to keep the included files from being indexed/viewed on their own
(possibly
> by password protecting [htaccess] the directory they are in)? Thanks in
> advance for any help.
>
> --
> Kyrie Eleison,
> Rick Beckman
> www.spiritsword.com/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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

Reply via email to