[ic] rewriting dynamic URIs to static ones

Rene Hertell interchange-users@icdevgroup.org
Thu Oct 31 14:26:01 2002


> > You should use an ActionMap. A perfect example is found here:
> >
> http://www.icdevgroup.org/pipermail/interchange-users/2002-May/021024.html
> >
> > My last site works completely with an ActionMap in each occation. This
> > makes my url:s look more clean :)
> >
> Thanks for the info. I'm _very_ new to IC... actually still evaluating
> whether to go with it or not.
>
> So, you have an ActionMap for each catalog? What did you mean by
> 'occation'?

Forgot to do a spell check :-) I meant occasion..

What I meant was that each my page/category has its own entry in the
ActionMap:

www.domain.com/cgi-bin/shop.cgi/events/2002
www.domain.com/cgi-bin/shop.cgi/press/new
www.domain.com/cgi-bin/shop.cgi/calendar/2002/10/31
www.domain.com/cgi-bin/shop.cgi/category/subcategory/
etc.

Here is a basic working example of an ActionMap that you add to your
catalog.cfg file or you can create a separate file with all your ActionMaps
eg. actionmap.cfg, and then you just include it in the catalog.cfg by adding
this line somewhere in the file:

include actionmap.cfg


Here is the example:

ActionMap announcements <<EOR
sub {
		my ($action, $page) = split ('/', shift);

            if ($page){
                $CGI-> {mv_nextpage} = 'announcement';
                $CGI-> {mv_arg} = $page;
			}
            else {
                $CGI-> {mv_nextpage} = 'announcements';
            }
		$CGI-> {mv_todo} = 'return';
		$Tag->update('process');
		return 1;
     }
EOR

The you create the announcement.html-file with the following content:

<html>
<head><title>Test</title></head>
<body>
	This is what was passed over here: [cgi mv_arg]
</body>
</html>

If the url was just www.domain.com/cgi-bin/shop.cgi/announcements, you will
be directed to the
announcements.html-file. Remember to restart your catalog


I hope that this helps.

Rene