PDA

View Full Version : include....



mrnatural
09-01-2007, 07:11 AM
hello eveyone.

what is the basic code to include html pages into a web page. i wont to be able to change all my website pages at once. its something like this...

<-include virtual......something or another->

bascially put i want a top and bottom pages i change with the middle the " differant" web pages.

thank you

james438
09-01-2007, 07:20 AM
There are a few ways to do this, but I use


<?php
include '../metastuff.php';
?>
or

<?php
include 'http://www.mysite.com/include/header.php';
?>
html stuff
<?php
include 'http://www.mysite.com/include/footer.php';
?>
oh, and if the files to be included are php files like shown above, be sure that the content in those included files are also contained in php tags otherwise it will be read as html.

ddadmin
09-01-2007, 08:56 AM
Or if your pages are of the .shtml extension, you would use SSI to include external files:


<!--#include file="external.htm"-->

<!--#include virtual="/external.htm"-->

More info here: http://javascriptkit.com/howto/ssi2.shtml

Twey
09-01-2007, 12:24 PM
The above will also work for ASP.

With Smarty, it's:
{include file='/external.tpl'}Django:
{&#37; include '/external.tpl' %}It really does depend on what you're using to write your site.

mrnatural
09-01-2007, 06:58 PM
thank you very much. that works.