[ic] Default file in pages subdir

Stefan Hornburg Racke interchange-users@icdevgroup.org
Thu Aug 1 03:12:06 2002


"Rene Hertell" <interchange-users@hertell.com> writes:

> > > Is there any option in specifying a default file (like DirectoryIndex in
> > > Apache) for a subdirectory to the pages-dir
> > (catroot/pages/sub_dir)? I don't
> > > want to use ActionMap, because every time I create a subdir, I have to
> > > create a new ActionMap in the catalog.cfg and reload the catalog. What
> > > probably would be an option would be some kind of dynamic ActionMap, but
> > > that I have to think out in how to create that..
> >
> > It would be pretty easy to do with an AutoLoad -- you could check
> > a path for the page name component being a directory and add
> > the desired name on the end.
> >
> > An action map would be harder, because in order to create the action
> > you have to have a path component. So all directories would need
> > to have the same root like dynamic/subdir/.
> >
> > We thought about adding that functionality at one time, but decided
> > the extra overhead was not desirable.
> > --
> > Mike Heins
> 
> I have tried to read the mail-archives and look in the docs regarding
> AutoLoad, but I can't understand how this action works.
> 
> Should it be defined in the page-template, or in the catalog.cfg? And how
> should I define the AutoLoad to catch from the URL a empty subdir
> (cgi-bin/cart.cgi/subdir), and display the index.html
> (cgi-bin/cart.cgi/subdir/index.html) page in that directory automagically?

Autoload <<EOS
sub {
    $url = $Session->{last_url};
    $url =~ s%^/cgi-bin/cart.cgi/%%;

    if (-d "/cat/whatever/$url") {
        $CGI->{mv_nextpage} = "$url/index.html";
    }    
}
EOS

[untested]

Ciao
        Racke

-- 
Prolific Interchange Consulting (Excellent German Quality !).
Take a look at Materialboerse (http://www.materialboerse.de/), WITT 
(http://www.witt-weiden.de/), Boxmover (http://shop.boxmover.ch/) or 
Passionshop (http://www.passionshop.com/racke). Need a shop ? Contact us.