[ic] Default file in pages subdir <- with working code

Rene Hertell interchange-users@icdevgroup.org
Fri Aug 2 05:02:00 2002


> -----Original Message-----
> From: interchange-users-admin@icdevgroup.org
> [mailto:interchange-users-admin@icdevgroup.org]On Behalf Of Kevin Walsh
> Sent: 02 August 2002 02:47
> To: interchange-users@icdevgroup.org
> Subject: RE: [ic] Default file in pages subdir
>
>
> >
> > 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...
> >
> "$Config->{VendRoot}/pages/$url"

Now I have a version that shows an index.html file if it exists:

create two usertags: isdir.tag

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

isfile.tag:

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

Then add the following code to catalog.cfg

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

     if ($Tag->isdir({path =>"$Config->{VendRoot}/pages/$url"}))
     {
        if ($Tag->isfile({path
=>"$Config->{VendRoot}/pages/$url/index.html"}))
        {
             $CGI->{mv_nextpage} = "$url/index.html";
        }
     }
[/perl]
EOS

This makes IC to show a index.html file if it exists in a directory, else it
just shows the normal missing.html error page.


For the moment this works great for me :)

Regards,

Rene