This is a dynamic header if you use include ‘header.php’ in your programming.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
| echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
// set title
if ($title == '')
$title = 'My home page'; // default title
$title .= ' - mydomain.com'; // append branding (e.g. your domain name)
echo '<title>'.$title.'</title>';
// set description if any
if ($description != '')
echo '<meta name="description" content="'.$description.'" />';
// set keyword
if ($keywords != '')
echo '<meta name="keywords" content="'.$keywords.'" />';
// insert css if any
if(!empty($css)){
foreach($css as $item){
echo '<link rel="stylesheet" href="'.$item.'" type="text/css" />';
}
}
// can have static if only one css available
echo '<link rel="stylesheet" href="style.css" type="text/css" />';
// insert javascript if any
if(!empty($js)){
foreach($js as $item){
echo '<script language="javascript" src="'.$item.'"></script>';
}
}
echo '</head>'; |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
// set title
if ($title == '')
$title = 'My home page'; // default title
$title .= ' - mydomain.com'; // append branding (e.g. your domain name)
echo '<title>'.$title.'</title>';
// set description if any
if ($description != '')
echo '<meta name="description" content="'.$description.'" />';
// set keyword
if ($keywords != '')
echo '<meta name="keywords" content="'.$keywords.'" />';
// insert css if any
if(!empty($css)){
foreach($css as $item){
echo '<link rel="stylesheet" href="'.$item.'" type="text/css" />';
}
}
// can have static if only one css available
echo '<link rel="stylesheet" href="style.css" type="text/css" />';
// insert javascript if any
if(!empty($js)){
foreach($js as $item){
echo '<script language="javascript" src="'.$item.'"></script>';
}
}
echo '</head>';
From the file you include, you can set something like this
1
2
3
4
5
6
7
8
9
| //set variables
$title = 'My home page';
$description = '';
$keyword = '';
$js = array('formvalidation.js','datecalc.js'); //include javascript
$css = array('style.css','form.css') // include css
//include header
include 'header.php'; |
//set variables
$title = 'My home page';
$description = '';
$keyword = '';
$js = array('formvalidation.js','datecalc.js'); //include javascript
$css = array('style.css','form.css') // include css
//include header
include 'header.php';