phpnewbie1 Posted April 9, 2006 Share Posted April 9, 2006 Sory if my english is bad.My applications have search engine friendly urls. I want to have diferent banners for all category.Its not posible with applications.I want to write the code:When php detect url: "http://mysite.com/category1/" then display banners for that category.when detect url: "http://mysite.com/category2/" then display banners for that category.I think this maybe done with IF. ELSE statement???Some like this:IF url = "http://mysite.com/category1/" {show baner page 1IF url = "http://mysite.com/category2/" {show banner page 2Its that posible?Can anyone help me to write this code?This 5 minutes job, but I not known to write it :-(Thanks anyway. Quote Link to comment Share on other sites More sharing options...
alpine Posted April 9, 2006 Share Posted April 9, 2006 this might be what you're looking for:[code]<?$uri = $_SERVER['REQUEST_URI'];$elements = explode("/", $uri);// see whats in itprint_r($elements);// use itif($elements[1]=="category1"){ print "you are in category1";}if($elements[1]=="category2"){ print "you are in category2";}?>[/code] Quote Link to comment Share on other sites More sharing options...
phpnewbie1 Posted April 10, 2006 Author Share Posted April 10, 2006 I put this code into php file ban.php and include in app, problem is next:"Array ( [0] => [1] => ban.php )"Do i do something wrong?If there any other way to do this?PLeasee helppp! Quote Link to comment Share on other sites More sharing options...
phpnewbie1 Posted April 13, 2006 Author Share Posted April 13, 2006 PLEASEEEE HELP WITH THIS!ITS that hard? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.