View Full Version : php includes
fadetoblack
05-27-2007, 03:30 PM
Hi, say I was doin a header php file to include on all my pages, do I need any html head info like meta tags etc.. and html doc type?
thanks
themanwhowas
05-27-2007, 05:55 PM
that depends. If on your pages you have meta tags and html, head, etc then no, you dont need to have these in your header file. You can however, have these in your include file and you would not then need to have these in your pages as they will be included via the header include.
eg. you have this header<?php
echo '<html>
<head>
<title>' . $title . '</title>
<meta etc>
</head>';
?>then in your pages you would just need<?php
$title = 'html forums';
include("header.php");
?>
<body>
blah
when the page is loaded in a browser, the source will look like this<html>
<head>
<title>html forums</title>
<meta etc>
</head>
<body>
blah
Does this answer your question?
Includes are just like telling the page to automatically copy and paste the includes contents into the parent page.
BonRouge
05-27-2007, 07:46 PM
It's like theman said, only you do need a DTD before that opening html tag.
themanwhowas
05-27-2007, 08:01 PM
whoops :poke: im very tired
fadetoblack
05-28-2007, 09:20 AM
yep, thats fine thanks.
vBulletin® v3.6.7, Copyright ©2000-2010, Jelsoft Enterprises Ltd.