Questioner
New member
I have a simple php system that consists of:
header.php- Just the header information of the layout.
footer.php- Just the footer information of the layout.
index.php- Includes() the header and footer files, as well as pages from a directory (url.com/index.php?page=page1)
Page folder- contains any page content (home.htm, page1.htm, etc), index.php includes() them (url.com/index.php?page=page1)
What I'm trying to do is change the <title> depending on which page is displaying. To accomplish this, I'm using a switch statement on the top of header.php:
<?php
$title="$title"
switch( $title)
{
case($page = 'home.htm')
$title = 'Title1';
break;
case($page = 'page1.htm')
$title = 'Title2';
break;
}
?>
And then the <head> reads:
<head>
<title><?php echo $title ?></title>
</head>
However, I receive an error with this (more specifically, an unexpected T_SWITCH on line 4).
I'm obviously new to all things php, so if anyone could explain what I did wrong I would appreciate it!
(Hopefully I explained everything clearly.)
header.php- Just the header information of the layout.
footer.php- Just the footer information of the layout.
index.php- Includes() the header and footer files, as well as pages from a directory (url.com/index.php?page=page1)
Page folder- contains any page content (home.htm, page1.htm, etc), index.php includes() them (url.com/index.php?page=page1)
What I'm trying to do is change the <title> depending on which page is displaying. To accomplish this, I'm using a switch statement on the top of header.php:
<?php
$title="$title"
switch( $title)
{
case($page = 'home.htm')
$title = 'Title1';
break;
case($page = 'page1.htm')
$title = 'Title2';
break;
}
?>
And then the <head> reads:
<head>
<title><?php echo $title ?></title>
</head>
However, I receive an error with this (more specifically, an unexpected T_SWITCH on line 4).
I'm obviously new to all things php, so if anyone could explain what I did wrong I would appreciate it!
(Hopefully I explained everything clearly.)