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

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


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

because  my class is  testimonials  and method is list


so i hope every body understand my problem














On 2/17/06, Brandon Black <blblack at gmail.com> wrote:
>
> On 2/17/06, Vidya Sagar <vsagarkola at gmail.com> wrote:
> > hi all ,
> >
> >  in my template  i have written
> > [%c.request.base%]/page/terms_conditions.html.
> >
> >
> >  given below code is written in maypole can i use for catalyst .
> >
> >  if i use where  can i put this   in my shop.pm or Shop/V/TT.pm
> >  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(@_);
> >
> >  }
> >
> >  This is not the whole code but a part of it and here is my TT.pm
> >
> >  package Shop::V::TT;
> >
> >  use strict;
> >  use base 'Catalyst::View::TT';
> >
> >  use HTML::Entities;
> >
> >  sub new {
> >          my $self = shift;
> >          $self->config->{WRAPPER}     = 'wrapper';
> >          $self->config->{COMPILE_DIR} = '/var/www/Shop/ttc';
> >          $self->config->{FILTERS}     = {html_entity =>
> > \&Shop::V::TT::html_encode_entities},
> >          $self->config->{CONTEXT} = undef;  # it will disable profiling
> of
> > templates
> >          $self->config->{ERROR} = 'error';
> >          return $self->SUPER::new(@_);
> >  }
> >
> >
> > Now in my browser, whenever i connect to any link in my web page it is
> > taking only html files, but my problem is that it should
> take  the  method
> > which is in .pm file- as html file and direct to the concerned html
> file.
> >
> >  kindly please help me
> >
>
> I don't think you can do this in quite this way, seeing as TT doesn't
> know anything about the individual html elements in the plaintext of
> your Template and the paths you want to modify are not variables in
> Catalyst code either, because they're hardcoded in the TT Template.
> You might be able to pull something off in your "end" Catalyst action
> that uses a regex substitution on $c->request->body after TT is done
> processing, but it would be an ugly hack and an ugly regex.
>
> I'm assuming that what you're trying to accomplish is importing a
> whole set of legacy TT templates for a site, and then convert them
> one-by-one into Catalyst actions and preprend the [% c.request.base %]
> to the links to that action when it has been converted (so that your
> app can run half old-style and half new-style during the transition),
> and you want to strip the '.html' part on the names which are Catalyst
> actions?
>
> If that's not the case, a better explanation of what you're
> functionally trying to accomplish would help.  If that is the case, I
> would suggest using a better approach, like perhaps removing the
> '.html' manually when you add the [% c.request.base %].
>
> Incidentlaly, you can use just [% base %], it's the same thing.
>
> -- Brandon
>
> _______________________________________________
> 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/7f90f82d/attachment-0001.htm


More information about the Catalyst mailing list