SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing an image dependent on the URL

    I am working on a site where I would like an image to be loaded into a table depending on what URL is loading. I figured a switch statement would do the trick, but due to my newbie-ness with PHP am not sure of the syntax. Basically if the url = main/index.php Then I want the img src = idexPicture.jpg.

    Does anyone know the syntax to do this?


  2. #2
    SitePoint Evangelist Waffles's Avatar
    Join Date
    Nov 2005
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you were using PHP navigation it would be easy...

    PHP Code:
    <?

    //yoursite.com?id=index

    if(isset($_GET['id'])) {

    echo 
    '<img src="'.$id.'.gif">';

    //would display index.gif

    }

    ?>

  3. #3
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not using PHP navigation, as a matter of fact I am using Javascript navigation. Isn't there a way to have the PHP look for what url is loading in order to pick a picture?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •