Deron Meranda
deron.meranda at gmail.com
Tue Jul 18 16:31:42 EDT 2006
On 7/18/06, Lukasz Szybalski <szybalski at gmail.com> wrote: > I am trying to display folders using PSP > [...code deleted...] > Now i would like it to change folder when clicked on one. > so let say we want to go to /etc. The easies way i see it is to use > POST. Add variable /etc to address on top and then read it in when > page is refreshed. > How do i append "/etc" (http://localhost/index.psp?/etc ???) to the > address and how do i read in the variable "/etc" from address bar > using PSP You probably want to use GET, not POST. The difference is in the semantics. What you are doing is retrieving a directory listing, you are not updating a resource. And GET is going to be a lot easier too. Generally what you are doing is mapping a virtual URL namespace into a filesystem namespace. (Of course this is what Apache itself is very good at doing, so you should have a good reason to do it yourself...of which, "just experiementing" may be a good reason). Anyway the basic way you go about doing that is to first, generate <a href="..."> links which have the "path" appended to the base url. Then you need a handler at the base url which always gets invoked; which in turn pulls off the extra url path, and interprets it directly. Also, you may want to do a bit of research on the so-called REST pattern. Start here: http://en.wikipedia.org/wiki/Representational_State_Transfer All that being said, one word of caution...it is very easy to compromize your system security if you are not careful. You should not allow any mapping to result in an absolute URL, and should trap against the use of directory components such as "..". -- Deron Meranda
|