[Radiant] Yeilding Snippets
Andrew Neil
andrew.jr.neil at googlemail.com
Wed Feb 13 17:59:09 CST 2008
Sean, thanks for your reply. I thought there would be more to it than
that, but you made it sound easy, so I gave it a go. Here is the ticket:
http://dev.radiantcms.org/radiant/ticket/611
http://dev.radiantcms.org/radiant/attachment/ticket/611/enable_snippets_as_double_tag_with_yield.diff
> You would need to capture the contents of the <r:snippet /> tag before
> rendering the snippet, either using tag.block or tag.expand and saving
> it in a local. Then your <r:yield /> tag would emit that local.
I wasn't sure how to save tag.expand in a local so that it was
accessible from <r:yield/>, so I've cheated a little:
snippet.content.gsub!(%r{<r\:yield\s?/?>}, tag.expand)
and making <r:yield/> output nothing. It's not exactly idiomatic, but
it passes the tests!
Cheers,
Drew
More information about the Radiant
mailing list