Forum Moderators: coopster
<?php
$request = $_SERVER['REQUEST_URI'];
if (isset($_GET['page']) && $_GET['page'] == 'about') { /* see if ?page is present and if it is equal to "about" */
echo '<span style="color: red; font-weight: bold;">About Us</span>';
}
else {
echo '<a href="?page=about" class="menu">About Us</a>';
}
?>
I don't work on many sites that use seperate pages like about.php contact.php and so on, but I have a question about if the above code can be modified to work on static pages.
I would like to see if that code could be changed to work in the same way so one include file can be inserted and for instance...keywords, descriptions, so on could be supplied based on domain.com/about.php
I tried to mess around with that code to get the request of a static page like about.php but didn't have any luck.
A general idea...
$request = $_SERVER['REQUEST_URI'];
somehow check that if $request equals domain.com/about.php
echo "keyword, keyword 1, keyword 2"; (can be anything really...specific to that page..graphics etc.)
Of course you can have http, https, w/ or w/o www. so domain.com/about.php would cover most. Thank you for any help, just a little curious.
$name = $_SERVER["PHP_SELF"];
#
switch($name) {
case '/about.php':
echo 'something';
break;
case 'another_page.php':
echo 'something else';
break;
etc...
}
I don't see why you would need to use any string parsing here unless I'm not understanding.