[ic] Default file in pages subdir

Jonathan Clark interchange-users@icdevgroup.org
Thu Aug 1 18:00:01 2002


> > > >
> > > > > > 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
> > > >
> > > >[snip]
> > > >
> > > >
> >Actually, I think it should work if you just remove the ".html" from the
> >mv_nextpage setting.
> >
> >--
> >Mike Heins
>
> Well,
> Here is a session from inktomi:
>
>   'one_time_path_alias' => {},
>   'path_alias' => {},
>   'ohost' => '66.196.72.93',
>   'last_url' => '/mfg/int',
>   'superuser' => undef,
>   'values' => {
>     'country' => 'US',
>     'mv_shipmode' => 'GNDCOM'
>   },
>   'admin' => undef,
>   'browser' => 'Mozilla/5.0 (Slurp/cat; slurp@inktomi.com;
> http://www.inktomi.com/slurp.html)',
>   'extension' => '',
>   'carts' => {
>     'main' => []
>   },
>   'user' => undef,
>   'scratch' => {
>     'mv_add_dot_html' => '1',
>     'mv_no_count' => '1',
>     'mv_no_session_id' => '1'
>   },
>   'time' => 1028173003,
>   'referer' => undef,
>   'arg' => undef,
>   'username' => undef,
>   'id' => 'K7GK5Vrk',
>   'pageCount' => 3,
>   'History' => [
>     [
>       '/mfg/int',
>       {
>         'mv_nextpage' => 'mfg/int',
>         'mv_session_id' => 'K7GK5Vrk'
>       }
>     ]
>   ]
> }
>
> It looks like they are leaving the index.html off as well
>
> so, if I request url:
> http://www.myweb.com/cgi-bin/cat/mfg/int
> or
> http://www.myweb.com/cgi-bin/cat/mfg/int/
>
> it gives the same result
> Sorry, the page (mfg/int/) was not found
> or
> Sorry, the page (mfg/int) was not found

The file test is being trapped by Safe. This should be showing up in your
error log.

I guess the way round this is to knock up a quick global usertag to do the
file check:


UserTag isdir Order path
UserTag isdir Routine <<EOR
sub {
        my ($path) = @_;
        return -d $path;
}
EOR

and then the following autoload:


Autoload <<EOS
[perl]
     $url = $Session->{last_url};

     if ($Tag->isdir({path =>
"/home/icdemo.webmaint.net/interchange/pages/$url"})){
         $CGI->{mv_nextpage} = "$url/index.html";
     }
[/perl]
EOS



Tested and working :-) see
http://icdemo.webmaint.net/cgi-bin/foundation_demo/test/index.html
http://icdemo.webmaint.net/cgi-bin/foundation_demo/test/


Now.. if I just new how to remove the hard-coded path in the Autoload...

Jonathan
Webmaint.