You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Patrick Galbraith <pa...@mysql.com> on 2006/11/20 20:37:12 UTC

Directory manipulations

Hi all,

Just a quick question:

I have a handler that is for user registration. The user logs in and 
then can do various tasks like viewing their files (say text files for 
example), change their password, editing files, etc.

The handler would be: http://my.site.com/userreg, and for instance, 
editing their profile would be

my.site.com/userreg?op=edit or my.site.com/userreg?op=profile (user is 
logged in as "username", using a session id from a cookie, session db)

How would I add code that makes user ops appear as sub directories of 
the handler such as in the case
of above:

my.site.com/userreg/username/edit, my.site.com/userreg/username/profile, 
and if editing a file

my.site.com/userreg/username/filefoo.txt... ?

I would want the handler to print the urls as well as be able to process 
the urls.

Any info on how to do this - thanks in advance!

Patrick

Re: Directory manipulations

Posted by Jonathan Vanasco <mo...@2xlp.com>.
personally, here's what i do:

I have a handler for my site  ( or my.site.com/userreg ) .   
everything goes to it.

all it does it this:
	instantiate a 'user' ( or ctx )
	instantiate a 'page' with the ctx (user)

the page then cleans the url, and then maps the cleaned url onto a  
page content class or default if nothing appropriate is found.

on your situation, you could probably just use mod_rewrite before mp  
gets the urls, and just regex stuff

Something like this:

	RewriteEngine On
		 RewriteRule ^/user/([a-z0-9]{4,16})(\/[.]*)?$ /user/index.php?&% 
{QUERY_STRING}&fmo_mode=user&fmo_user=$1 [T=application/x-httpd-php,L]

( yes, i'm running a subdomain of php stuff.  i needed to support  
openid, and the protocol caused too much blocking on apache under  
mod_perl .  )


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -