[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Bypassing the whole [more] system
Quoting Schuyler W Langdon (gorditos@hotmail.com):
> Mike Heins wrote:
> <snip>
> > I have been thinking about configurable missing-URL routines. Right now,
> > the default is that if a page is not found, a flypage is tried. If that
> > is not found, then in 4.9 the DirectoryIndex is tried (allowing index.html
> > to be the index page for a directory). Then it is passed to the special
> > page "missing", whatever that is defined to be.
> >
> > I thought of adding a "PageResolution" directive, i.e.:
> >
> > PageResolution category_page Vend::Interpolate::fly_page
> >
> > That would allow the Sub/GlobalSub "category_page" to get first crack
> > at a missing URL, followed by a try at the flypage.
> >
>
> I really like this idea, it will add a great deal of customization
> potential.
ActionMap was the thing I designed that was supposed to handle this --
you can create one "foo" and then every path that begins with /foo/
will use that.
The other way I have done this is to put the logic on the "missing"
page.
> Is it something that will be implemented?
Maybe, if it gets fleshed out a bit.
> In the mean time, I set
> this up by modifying Page.pm a little so it checks PageResolution (which I
> have defaulted to Vend::Interpolate::fly_page) and looping through the args
> passed (@foobar) something like this:
> my $save=undef;
> foreach(@foobar){
> $cr = \&$_;
> $save = delete $SIG{__DIE__} if defined $SIG{__DIE__};
> $page = eval {$cr->($name)};
> $SIG{__DIE__} = $save if defined $save;
> last if(defined $page);}
>
> It seems to work allright, but I don't know where to declare a global sub
> for something like "category_page"? I tried adding it to the cfg file and it
> gives a compile error "unknown directive GlobalSub".
GlobalSub goes anywhere in interchange.cfg and its includes. You would
want something like:
foreach (@foobar) {
if(/^\w+$/) {
$cr = $Vend::Cfg->{Sub}{$_} || $Global::GlobalSub->{$_};
}
else {
$cr = \&{$_};
}
if (! defined $cr) {
logGlobal("Undefined PageResolution routine '%s', $_);
return undef;
}
....
}
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.513.523.7621 <mike@perusion.com>
I have a cop friend who thinks he ought be able to give a new ticket;
"too dumb for conditions".