But why would you ever do that? Layouts are designed to
hold the parts of your view that don't change. If they don't change,
you shouldn't need to generate them on the fly.
What I'd really like to be able to do is to allow for an external
layout. That is, when another site links to the resource, it could
append a parameter to the URL specifying the URL of an alternative
layout to be used. Typically the alternative layout would be located
on the host linking *TO* the resource. I'd have to get the layout
across the network and that's how I wind up with it in a variable.
I hope you're going to cache that layout....
I mentioned this in another post and from the limited responses that I
received I concluded that almost no one else has any interest in doing
this sort of thing. I find that a bit surprising and it leaves me
wondering if I am not missing some other more popular way of skinning
this cat. Anyway, that's the rationale behind my inquiry. Thanks for
Why not make your third party partners create a special HTML page and include an HTML comment that indicates where the content goes. Something like...
<h1>My Groovy Layout</h1>
<!-- CONTENT -->
Whatever they want as long as that comment is there.
Then you can read in that file, split it on that html comment and assign the first half to @top and the second half to @bottom and then have a layout like:
<%= @top %>
<%= yield %>
<%= @bottom %>
I'd probably pick better names for top/bottom to avoid conflicts, but you get the idea.
I'm ignoring all of the issues surrounding relative/absolute urls to JS, CSS, images and any XSS issues, etc...
And whatever you do... cache it for awhile.