> Hi Jon,
>
> Am 18.06.2011 um 14:23 schrieb Jonathan Swartz:
>
>> If you just want to avoid wrapping, this is probably better:
>>
>> <%method render>
>> % $.main();
>> </%method>
>>
>> You'll still inherit from the default parent class, so you can share
>> methods, attributes, etc. - it's just that render will call main() instead
>> of wrap().
>>
>> I have an item in my todo list that says "make this easier" :), since it is
>> such a common desire. Suggestions welcome.
>
> what I often need is to disable wrapping if a parameter is set. For example
> in Catalyst, I can check if a request is an AJAX request, and if it is, I'd
> like the header and footer to not be rendered but only the component itself.
> How can I do this?
Just put this logic in the render method - it has access to the parameters. If
you want wrapping, call wrap(), otherwise call main(). e.g.
<%args>
$.type
</%args>
<%class>
method render {
if ($.type eq 'ajax') {
$.main(); # skip wrapping
}
else {
$.wrap(); # do wrapping
}
}
</%class>
Here I've moved the render method into a <%class> section since it has more
than a few lines of Perl.
HTH
Jon
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users