How do you get a seperate title for each included page? Because the title of page.php and page.php?page=whatever is the same.same way you do when you include the page in the url.
if($_GET['page']){
$title = "some title";
} else {
$title = "default";
}
echo"<title>$title</title>";Err...OK...so do I keep everything the same and just add that in the code? Do I need to add anything else to the ?page= part?
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'main';
}
switch ($page) {
case 'gallery':
include 'gallery.php';
break;
case 'games':
include 'games.php';
break;
default:
include 'main.php';
}
?>
Where would I add it in there?the code I showed you has to be at the top before any html and has nothing to do with the code you showed, it just is the same concept. it should be seperate form the include sectionOK, but how do I make it different for each page I include?I already showed you in my first post
show some code you have now and I will add itOKI am ashamed Josh, after all the talk about doctypes you still didn't have one , np, I added one for you
ok, look at the very top of this file and you can see it. you can change it to anythign you want of course.Yah yah, I was waiting til I was done to validate it. I knew it would be something like that. Thanks scoutt wait, in this part:
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'main';
}
shouldn't the variable $page be $title?
EDIT: OK, so maybe I should try things out first Yes it should be $title, and it works.
EDIT AGAIN: OK, so it works both ways...which one should I use? Or does it even matter?no it has to be $page cause you want to get the correct title for the correct page.
if you use title then that switch isn't working.OK, I get it. I'm trying to make since of the code.
So $_GET[] part gets the page when the case is typed in.
I don't understand what isset() does though.The isset checks that the variable is set, i.e. it checks that it isn't blank.Oh ok, I see.
if($_GET['page']){
$title = "some title";
} else {
$title = "default";
}
echo"<title>$title</title>";Err...OK...so do I keep everything the same and just add that in the code? Do I need to add anything else to the ?page= part?
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'main';
}
switch ($page) {
case 'gallery':
include 'gallery.php';
break;
case 'games':
include 'games.php';
break;
default:
include 'main.php';
}
?>
Where would I add it in there?the code I showed you has to be at the top before any html and has nothing to do with the code you showed, it just is the same concept. it should be seperate form the include sectionOK, but how do I make it different for each page I include?I already showed you in my first post
show some code you have now and I will add itOKI am ashamed Josh, after all the talk about doctypes you still didn't have one , np, I added one for you
ok, look at the very top of this file and you can see it. you can change it to anythign you want of course.Yah yah, I was waiting til I was done to validate it. I knew it would be something like that. Thanks scoutt wait, in this part:
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 'main';
}
shouldn't the variable $page be $title?
EDIT: OK, so maybe I should try things out first Yes it should be $title, and it works.
EDIT AGAIN: OK, so it works both ways...which one should I use? Or does it even matter?no it has to be $page cause you want to get the correct title for the correct page.
if you use title then that switch isn't working.OK, I get it. I'm trying to make since of the code.
So $_GET[] part gets the page when the case is typed in.
I don't understand what isset() does though.The isset checks that the variable is set, i.e. it checks that it isn't blank.Oh ok, I see.