It's pretty easy with PHP, but a bit more work than just html.
PHP Code:
TOP OF YOUR PAGE:
<?php
if (strpos($_SERVER[REQUEST_URI],"baseball") !== FALSE) {
$image = "baseball";
}
?>
////INSERT YOUR HTML HERE
<img src="images/<?php echo $image; ?>.jpg">
The first part checks if "baseball" is part of the current URI (like URL) of the page. If it returns true (as in not FALSE), then $image is set to "baseball".
Later, in the image tag, the image included is set to images/$image.jpg, where image is "baseball", so it's images/baseball.jpg.
You can do other things, like you should have else {$image = "basketball";}
or something in case baseball isn't in the URI.
You could also check if ($_SERVER[REQUEST_URI] == "exacturl") {....dostuff...}
And that, if you put an address in there, be used to show you if the page was exactly "http://google.com", etc., etc.
NOTE: To use php it must be installed and enabled on your server and each page with php code must end in the extension .php. HTML, etc. will continue to work as before. You don't need to do anything special... just rename any .htm/.html/etc page to .php and it will be fine. The only difference is that <?php ... ?> commands will then be processed.
PHP is server side, so it outputs html, not the php source. It runs, then sends to the user.
Bookmarks