View Single Post
Old 04-27-2005, 11:20 AM   #4 (permalink)
ratbastid
Darth Papa
 
ratbastid's Avatar
 
Location: Yonder
...But you want to be able to bring in images from any directory? Is that it?

You could write a nested array of directories and then refer to the directories by array index. But that's sort of fugly.

I suggest you use the oft-overlooked PATH_INFO field to pass the file location, rather than a query-string parameter.

In the url:
http://www.arch13.com/index.php/imgs...r11?id=brewery

You should end up in index.php with:

$_REQUEST[id] = "brewery"
and
$_SERVER[PATH_INFO] = "/imgs/brewery/brewerycolor11"

It's still a lengthy URL, but it's not carying a ton of extra info in the QUERY_STRING, and it looks (except for that ".php" in there) like any old URL to a file or directory.

PATH_INFO is great for hiding the fact that it's a dynamic page. I one time turned on CGI-EXEC on the root htdocs directory, put a Perl CGI in there called "pages", and called it with URLs like:

http://www.site.com/pages/product/1234.html

My "pages" script then spun out a page based on my "product" template with data from MySQL for item number "1234", and Google was none the wiser.
ratbastid is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76