$_SERVER['REQUEST_URI']
Posted: Tue Jun 15, 2010 1:24 pm
Hi all,
I am new to PHP Programming, but I am looking to do the following. Here is the code I currently have:
The problem I am having is, in the IF Statement I want to put "If $currentpage=='/Catalog/*". Where the * means anything can come after it, but the start of the string must stay as "/Catalog/".
The same in the case statements, I want to allow any value to appear after that, I just need the start to be "/Catalog/<option>/"
If there a wild card symbol I can use to put in place after the last "/". Is there a way I can also make everything insensitive to case.
Kind Regards
Tom Noble
I am new to PHP Programming, but I am looking to do the following. Here is the code I currently have:
Code: Select all
<?php
//Return the string after the domain name e.g /home
$currentpage = $_SERVER['REQUEST_URI'];
//Check to see if the current page is part of the Catalog
If ($currentpage=='/Catalog') //Check this syntax
{
// set up a switch and set the currency value appropriately
switch ($currentpage) {
case "/catalog/UK/";
//Set the currency value to UK here
break;
case "/catalog/EU/";
//Set the currency value to EU here
break;
case "/catalog/NonEU/";
//Set the currency value to NonEU here
break;
case "/catalog/US/";
//Set the currency value to US here
break;
case "/catalog/ROTW";
Echo $currentpage;
break;
}
}
?>The same in the case statements, I want to allow any value to appear after that, I just need the start to be "/Catalog/<option>/"
If there a wild card symbol I can use to put in place after the last "/". Is there a way I can also make everything insensitive to case.
Kind Regards
Tom Noble