I have a page that called brewery.php on my site. It's laid out in total CSS with PHP variable scripts. I call this page into a parent page using the include comand.
Thus, a typical address would be
www.arch13.com/index.php?id=main where main is the nested page being called into the parent template index.php.
Now I have a page called brewery.php that containes some new photography and I am looking at new ways of creating gallery's. The current PHP code being used on the page is:
Code:
$id = $_REQUEST['id2'];
if(file_exists($id.".jpg")) {
echo "<img src='$id.jpg'>";
} elseif(file_exists($id.".php")) {
include($id.".php");
} else {
echo "<img src='brewerysplash.jpg'>";
}
Yes it works, but it also creates ugly, ugly, ugly urls. Like
http://www.arch13.com/index.php?id=b...ewery/brewery1
Is their a way to simplify this? What I'm looking for is a way to keep the url looking like
www.arch13.com/index.php?id=brewery , and then have the id2= hidden, even though it was passed to get the picture it refrences. Perhaps like having brewery.php?id=1 where 1 is the first picture.
Am I making any sense?
The second question I suspect is easier.
the images for brewery.php are named brewery_x.jpg where x is the number of the image in order.
What code would allow id2=1 and call brewery_1.jpg? So that as the id # increased by 1, it just called the next image, assuming the brewery_ part?
Is there a way to go about this that does not require hand coding the image name prefix (brewery_) into the php code, to make such a script usefull in multipule areas?