Re: Delayed output generation feature?
Alex Robinson <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <a06200701be1d408443f6@[192.168.0.2]> |
>So things to think about ...
>
>- Is this a worthwhile feature?
I think so. Or rather the whole placeholdery thing is worthwhile (but
more on that at the end)
>- Is there a better/faster/cooler way to implement it?
Well, what about, instead of
>>>>
<html>
<head>
% $m->delayed_output( sub { $m->comp('/lib/javascript_links.mas' ) } );
</head>
...
</html>
<<<<
pointing out to people that you don't have to output $m->call_next()
immediately, but that you can stick it in a variable, eg.
>>>>
<html>
<head>
<& /lib/javascript_links.mas &>
</head>
...
<% $output %>
...
</html>
<%init>
my $output = $m->call_next();
</%init>
<<<<
Is there anything that delayed_output would add that this simple use
of existing functionality doesn't?
As for the previously mentioned $m->placeholder mechanism, doesn't
$m->notes essentially fill that gap?
The above is what I'm doing and then stashing values in $m->notes
(using component calls as my API though) and retrieving those values
at the appropriate moment, ie. when wrapping the output.
Scripts and styles can be inserted at any time. I simply pass a
location for the file or actual content along with a priority value
so that there is control over the order that these snippets are
ordered. I also have mechanisms in place to prevent multiple
registration of the same files/code. This enables calls to components
to insert the javascript or css that they require even if those
components are called repeatedly. Script/style blocks can also be
wrapped in IE conditional tags. The script/style urls also get
versioned.
In fact, any part of the head block (or html or body element) can be
modified in this way. Nor is this approach limited to any particular
doctype or indeed even html.
Now the way I've implemented it is definitely not the fastest.
However it does make life easier and quicker for me as a
designer/javascript/css wonk. And with appropriate cacheing the speed
issue is not so important.
So Dave, I ask again what your proposed new method really adds to
what is already availbale?
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl