[Catalyst] How to trail the .html files in my control

Vidya Sagar vsagarkola at gmail.com
Fri Feb 17 18:40:48 CET 2006


Thank you very much both Mr.Black and Mr.Wright for the answers u have
given.but another issue is u can do only for one or two methods like 'list"
but we are having lots of methods.so what shall we do.i will give my actual
code just which will work for all the html files,when i used maypole  go
through it and tell me what to do,

sub parse_path {

        my $self = shift;
        # remove the trailing .html for any path other than starting with
/page/
        $self->{path} =~ s/\.html$// if $self->{path} !~ /^page\//;

        $self->SUPER::parse_path(@_);

        # translate old paths into new paths
        if($self->{path} =~ /cgi-bin\/store\/index.cgi/) {

                my $table = $self->{ar}->parms;

                if($table->get('page')) {
                        if($table->get('page') =~ /officeprods.cgi/) {
                                $self->{table} = 'categories';
                                $self->{action} = 'officeproducts';
                        }
                        elsif($table->get('page') =~ /arrow-faq.htm/) {
                                $self->{path} = 'page/arrow-faq.htm';
                        }
                }
                elsif($table->get('product') || $table->get('keywords')) {
                        # search product category
                        $self->{table} = 'product';
                        $self->{action} = 'find';
                        $table->set('keywords', $table->get('keywords')."
".$table->get('product'));
                }
                else { # catch all condition send the user to home page
                        $self->{path} = 'frontpage';
                }

                $table->unset('exact_match');
                $table->unset('product');
                $table->unset('cat_row');
                $table->unset('cart_id');
                $table->unset('search_stores');
                $table->unset('page');
                # dont remove the source parameter. it is needed to decide
on popup window
                #$table->unset('source');
        }
}

The above code is in May Pole..can i use the same code in catalyst and get
the result which we got previously.Just go through it thoroughly and help
me,thank you.





On 2/17/06, Chisel Wright <chisel at herlpacker.co.uk> wrote:
>
> On Fri, Feb 17, 2006 at 10:44:48PM +0530, Vidya Sagar wrote:
> >    let me explain  in detailed
> >
> >    here is one of  my  template file  i have written like this
> >
> >    <table cellpadding="0" cellspacing="0" border="0" width="100%"
> >    height="30">
> >
> >    <a href="[%c.request.uri_base%]/testimonials/list.html"
> >    class="sm2">Testimonials</a>&nbsp;|&nbsp;
> >    <a href="[%c.request.uri_base%]/page/terms_of_use.html"
> class="sm2">Terms
> >    & Conditions</a>&nbsp;|&nbsp;
> >    <a href="[%c.request.uri_base%]/page/privacy.html"
> class="sm2">Privacy
> >    Policy</a>
> >    </td></tr>
> >    </table>
> >
> >    above frist link  testimonial is my class and list is my method
> >
> >    if i am giving   [%c.request.uri_base%]/testimonials/list it is
> wroking
> >    but if i am
> giving  [%c.request.uri_base%]/testimonials/list.html  it's
> >    not wroking
>
> So something *like*:
>
> sub path_magic : Regexp('^testimonials/(.*).html$') {
>   my ($self, $c) = @_;
>   $c->stash->{template} = $c->req->snippets->[0];
> }
>
> maybe?
> --
> Chisel Wright
> e: chisel at herlpacker.co.uk
> w: http://www.herlpacker.co.uk/
>
> This is not an automated signature. I type this in to the bottom of every
> message.
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060217/f242fa9e/attachment.htm


More information about the Catalyst mailing list