Jump to content

Detecting URL problems


phpnewbie1

Recommended Posts

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.

Link to comment
Share on other sites

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

$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";
}

?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.