Not to steal your thread, but I'm having trouble combining absolute url's with the php include statement, it doesn't display when I use: <?php include("http://www.all-history.com/header.php"); ?> But it does when I use: <?php include("header.php"); ?> Could someone elaborate on the stuff already told in this thread? Thanks in advance.
You need to use the file path in an include. For example yourname/public_html/includes And in answer to the other question html files can include php code if you use htaccess to alter the way the server parses them.
<?phpinclude("header.php");?>body content here<?phpinclude("footer.php");?> PHP: one final question. if i decide to actually just use php, would i postition where the header goes in the header.php or in the main page? can i have the header in a table?
The idea of headers and footers are to move the content that stays the same on every page from the main page files into external files. Why not try it out rather than asking here?
you can use smarty .u get the what would like. otherwise you can u includes files of header and footer .
Hmm. I still can't figure it out. If I use httpdocs/header.php it still doesn't work. How exactly does this filepath work? Where do you begin and where do you end?
why spend alot of time trying to do something im not even sure is possible, when i can just come here and ask for the answer. this is the purpose of this board, is it not? now on a side note, i make most of layouts and templates in tables, can i put php files into a cell of a table?
The filename can be absolute or relative. Assuming a *nix environment here is a working example: / + var/ + www/ header.html footer.html + public_html/ index.php Code (markup): From index.php you can include header.html and footer.html one of these two ways: include("/var/www/header.html"); include("/var/www/footer.html"); PHP: or like this include("../header.html"); include("../footer.html"); PHP: HTH
It was made one of two ways. A) They are actually static html files or B) In order for a file to be processed by the php interpreter the web server needs to configured in such a manner that it knows what file extensions are to be sent to php. Which means you can configure any file extension to be sent to php, it does not have to have a .php extension. If you wanted file extensions with .evilpenguin to be processed by php, you simply configure your web server to handle them that way. In the website that you gave as an example, I would not suggest to send .html files to php. The reason why not is because every .html file would be sent to php regardless if it had any php code or not. Which in turn means that your pages are not being served as fast as they could because they need to be parsed by the php interpreter prior to rendering. HTH
put this code in a php page, say info.php : <?php echo phpinfo(); ?> when you load the page, you can see the proper filepath that you need to use