Sam Carleton wrote: > On 3/27/07, Sam Carleton <[EMAIL PROTECTED]> wrote: >> On 3/27/07, Issac Goldstand <[EMAIL PROTECTED]> wrote: >> >> > > More importantly, lets say my module is called mod_coolapp and >> when I >> > > have it installed, you get to it at /coolapp. I want /coolapp to be >> > > the equivalent to the index.php and then have say, >> /coolapp/images be >> > > the same as imageHandler.php. Is there any trick to knowing which >> > > "page" is being requested or is it simply a matter of doing a string >> > > compare to see if the first part of the string passed the actual URL >> > > (/coolapp/) is images? >> > > >> > You're going to want to parse/compare the string. The "Right Way(tm)" >> > to do this would probably be during the translate_name or possibly >> > map_to_storage hooks to separate the URI mapping logic from the actual >> > response processing logic. >> >> You totally lost me with the "translate_name" and "map_to_storage", I >> will have to do some reading on it. > > Issac, > > I am not exactly sure how I would leverage either the translate_name > hook or map_to_storage hook. The best I can figure is that I should > hook translate_name and this is the translation: > > /coolapp?<params> --> /coolapp?type=index&<params> > > /coolapp/images?<params> --> /coolapp?type=image&<params> > > Do I have the right idea? > > Sam Yes, it's the correct direction, but if you're just going to mangle the query string, you could just as easily do it with mod_rewrite. The only reason you'd need to code anything in your own module is if you want to, say, guarantee that <params> contains a valid image file before continuing the request chain; in such a scenario, you'd add a handler to map_to_storage which does at least a partial parsing of <params> and checks that the requested image exists, and if not aborts with a 404 error.
Issac
