Define empty methods in your autohandler and override them in your
component.

In autohandler:
<%method footer></%method>

In my.comp:
<%method footer><& footer.comp &></%method>

The inheritance mechanism causes the footer method in the autohandler to be
replaced by the one in my.comp (which in this example calls footer.comp).
If you don't want any footer text for a given component, just omit the
method, and the one in the autohandler (which does nothing) will be used.
You can use the same technique for setting the title and meta tags in the
header.

See http://www.masonbook.com/book/chapter-5.mhtml#TOC-ANCHOR-4 for a more in
depth discussion.

-----Original Message-----
From: MK [mailto:halfcountp...@intergate.com] 
Sent: Monday, November 30, 2009 1:40 AM
To: mason-users@lists.sourceforge.net
Subject: [Mason] no args for autohandler?

I haven't been using autohandlers at all because half my components are for
ajax calls and so should not be wrapped -- instead, I just use a header.comp
for the normal pages.

Now I have a directory of small components that can occur in several
different places with a slight variation, so I have a simple boolean arg
(supplied, or not supplied) to distinguish whether they are appearing in one
place or another.  This variation is always the same, so I thought it would
be a good directory to use an autohandler in:

% if (exists $ARGS{foot}) {
   <blah blah>
% else {
   <whatever>
% }
% $m->call_next.

It appears the autohandler does not work this way, ie, does not process any
arguments.

Not a big deal; it is almost as easy to just use a default component at the
top in all the other files and pass the arg on:

<& default.comp, foot=>$ARGS{foot} &>

but I thought I'd check and see if there isn't something I'd missed here.
Also, is there an easy way to pass the entirity of %ARGS on? Something like:

<& comp, ARGS=>%ARGS &>

-- 
MK <halfcountp...@intergate.com>

----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to