[Catalyst] How can we parse the path in catalyst
Vidya Sagar
vsagarkola at gmail.com
Tue Feb 28 18:42:42 CET 2006
Hello all,
how can i parse the path ie url in catalyst..my old code is:
# parse path. it will translate old urls into new urls.
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');
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060228/4f21fc6a/attachment.htm
More information about the Catalyst
mailing list