I have a page that uses several if and elseif statements and I would like to adjust the title per what if/elseif statement is served.
Is there anyway to perform this using a variable?
I have a page that uses several if and elseif statements and I would like to adjust the title per what if/elseif statement is served.
Is there anyway to perform this using a variable?
All you would need to do is something like this:
And then you can switch that around to be completely random:PHP Code:<?php
$varTitleDetermind = "Hello";
if($varTitleDetermind != "GoodBye"){
$varTitleDetermind = "Hello, your IP is: ".$_SERVER["REMOTE_ADDR"];
}
else {
$varTitleDetermind = "Goodbye ".$_SERVER["REMOTE_ADDR"];
}
echo "<title>".$varTitleDetermind."</title>";
?>
PHP Code:<?php
$varTitleDetermind = rand(0,1);
if($varTitleDetermind){
$varTitleDetermind = "This title is displaying because the \$varTitleDetermind is true";
}
else {
$varTitleDetermind = "This title is displaying because the \$varTitleDetermind is false";
}
echo "<title>".$varTitleDetermind."</title>";
?>
Jeremy | jfein.net
xcoaster1 (07-03-2008)
so if im calling the page with a $_GET where the variable is passed via the URL, I can use something similar to determine the title of the page.
Each variable will return a different set of information, so for the year search, I would want the page title to list year and the page info and for the status, it would show active posts/page in the title.
Code:if ($year >= "2003") { print table }elseif ($status == "1") { print table }else{ print info
Well, it should be this:
But, you've got the idea.PHP Code:if ($year >= "2003") {
print "table";
}elseif ($status == "1") {
print "table";
}else{
print "info";
}
![]()
Jeremy | jfein.net
Bookmarks