[Catalyst] Can't get view / template to work ?

Rob Brown rob at intelcompute.com
Tue Oct 30 16:58:22 GMT 2012


the paths are from /root/src (as per the config), so if you've created 
another folder called "login" and put the file in there, you'd need to 
say...

$c->stash(template => 'login/login.tp');


On 10/30/2012 04:52 PM, Craig Chant wrote:
> I seem stuck with implementing my first view / template.
>
> I have a controller Login.pm
>
> I ran the view helper script ‘create view HTML HTML::template’
>
> As per the tutorial I’ve added the following to the config section of
> MyApp.pm
>
> TEMPLATE_EXTENSION => '.tp',
>
> 'View::HTML' => {
>
> #Set the location for templates files
>
> INCLUDE_PATH => [
>
> __PACKAGE__->path_to( 'root', 'src' ),
>
> ],
>
> },
>
> I have created a template in ‘root/src/login’ of login.tp
>
> In my controller I have …
>
> sub login :Path :Args(0) {
>
> my ( $self, $c) = @_;
>
> $c->stash(template => 'login.tp');
>
> }
>
> But all I get is…
>
> Caught exception in Members::View::HTML->process "HTML::Template->new()
> : Cannot open included file login.tp : file not found. at
> C:/Perl/lib/HTML/Template.pm line 1813
>
> I’ve also tried..
>
> $c->stash(template => 'login');
>
> $c->stash(template => 'login/login');
>
> $c->stash(template => 'login/login.tp');
>
> None of which seem to work?
>
> What am I doing wrong?
>
> */Craig Chant/*
>
> I.T. Manager
>
> Description: cid:image001.png at 01CD5F4A.17E848D0
>
> Main Line 01903 602664
>
> Direct Line 01903 227753
>
> Visit our website http://www.homeloanpartnership.com
>
> *HomeLoan Partnership have been named the Best Mortgage Network, 2012,
> at the myintroducer.com Industry Awards*
>
> This Email and any attachments contain confidential information and is
> intended solely for the individual to whom it is addressed. If this
> Email has been misdirected, please notify the author as soon as
> possible. If you are not the intended recipient you must not disclose,
> distribute, copy, print or rely on any of the information contained, and
> all copies must be deleted immediately. Whilst we take reasonable steps
> to try to identify any software viruses, any attachments to this e-mail
> may nevertheless contain viruses, which our anti-virus software has
> failed to identify. You should therefore carry out your own anti-virus
> checks before opening any documents. HomeLoan Partnership will not
> accept any liability for damage caused by computer viruses emanating
> from any attachment or other document supplied with this e-mail.
> HomeLoan Partnership reserves the right to monitor and archive all
> e-mail communications through its network. No representative or employee
> of HomeLoan Partnership has the authority to enter into any contract on
> behalf of HomeLoan Partnership by email. HomeLoan Partnership is a
> trading name of H L Partnership Limited, registered in England and Wales
> with Registration Number 5011722. Registered office: 26-34 Old Street,
> London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by
> the Financial Services Authority.
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/

-- 
IntelCompute
Web Design & Online Marketing Experts

http://www.intelcompute.com



More information about the Catalyst mailing list