[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] a question about urls mapping to the project directory layout


how does my url map to my various sub apps? Taking the example of a
relatively common app which has a general public area, a members only
area, and an admins only area, I would like my url to still stay

You mean you have "sub-apps" as in many instance scripts (as opposed to just one script with many runmodes)?
If so, you should use the URL to dispatch between the scripts.

You could have

http://myapp/members/
http://myapp/public/
http://myapp/admins/


http://myapp/index.cgi/do_something?based_on_this=that

(I would probably hide 'index.cgi' from the above url via mod_rewrite,
but that is not the point of this query).

You do not need mod_rewrite for that.
A simple
	ScriptAlias /myapp /path/to/your/index.cgi/
will do.


The above would imply that I would have only one index.cgi, hence one
instantiation of my $public_app. How would I go about getting hold of
the correct $member_app or $admin_app based on who is looking at my
app (public or a common member or an admin)?

If you do not want to have separate scripts, you could

	1) have different runmodes for different people.
		The runmodes can check if access is permitted or not.

	2) have the same runmode do different things for different people
		(which is maybe a little confusing)

It seems you want to have your default runmode do different things for different people.
(Method 2 above)
I would set up a default runmode that just dispatches to the appropriate runmode for that group.

sub start{
	my ($app) = @_;
	# find out somehow what we really want as a start page
	return $self->admin_start() if $admin;
	return $self->member_start() if $member;
	return $self->public_start();
}

Doing this keeps the start page URL simple and same for everyone.
For subsequent runmodes I would have separate runmodes for different groups (Method 1)





Hope that helps, I confused myself a little writing this,

Thilo


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.