I have written the code in javascript but i need it to happen in serverside, The function gets the part of the requested url and if it's match my switch it's change the ducoment title.
Here is the Javascript:
$(document).ready(function(e){
e=window.location.href;
if(e.match(/\\?case=(.*)/)){
x=e.match(/\\?case=(.*)/);
y=x[1];
switch(y){
case :"t"
document.title ="Title2";
break;
case :"s"
document.title ="Title3";
break;
default:
/* code ... */
break;
}
}
});
In this code if my url is "http://url.com/?case=t" the title of document going to change to "Title2".
How can i write it in php? the problem is getting the url match!