[Catalyst] Using a post argument in a template

James S. White james at jameswhite.org
Fri Jul 25 13:40:59 BST 2008


I was trying to munge the paramaters in the controller, I just can't figure
out how to access the variables of a controller method in the template. I'd
be more than happy to pass the argument to a controller, and then have the
view fetch it from the controller, and then the template read it from the view,
If I had any idea how to dereference the variables in order to set them in
new components. I was just trying to keep it walk before running and I keep
tripping over my feet.


On Fri, 25 Jul 2008, Eden Cardim wrote:

> On Fri, Jul 25, 2008 at 1:12 AM, James S. White <james at jameswhite.org> wrote:
> > I'm passing an argument to the method via a post, and then catch it with
> > my ( $self, $c, $myarg ) = @_; shouldn't there be a way to mine it without
> > using [% c.req.arguments.0 %] in the template?
> >
> > like [% c.controller('Page').methodname.myarg %] or something...
>
> You want [% c.req.body_params.myarg %] if it's a post, [%
> c.req.params.myarg %] if you don't care. I would munge the parameters
> in the controller and try to formalize an API to interact with the
> view though. Also, avoid making your view-side code be
> controller-dependent, you'll surely regret it later.
>
> --
> edenc.vox.com
>




More information about the Catalyst mailing list