Jump to content


Photo

Detecting URL problems


  • Please log in to reply
3 replies to this topic

#1 phpnewbie1

phpnewbie1
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 April 2006 - 07:21 PM

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 1

IF url = "http://mysite.com/category2/" {
show banner page 2

Its that posible?

Can anyone help me to write this code?

This 5 minutes job, but I not known to write it :-(

Thanks anyway.



#2 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 09 April 2006 - 08:48 PM

this might be what you're looking for:
<?

$uri = $_SERVER['REQUEST_URI'];
$elements = explode("/", $uri);

// see whats in it
print_r($elements);

// use it
if($elements[1]=="category1")
{
  print "you are in category1";
}
if($elements[1]=="category2")
{
  print "you are in category2";
}

?>


#3 phpnewbie1

phpnewbie1
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 10 April 2006 - 02:53 AM

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!

#4 phpnewbie1

phpnewbie1
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 13 April 2006 - 01:46 AM

PLEASEEEE HELP WITH THIS!

ITS that hard?





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users