[Radiant] Yeilding Snippets
Sean Cribbs
seancribbs at gmail.com
Mon Feb 11 22:16:35 CST 2008
Andrew,
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.
Sean
Andrew Neil wrote:
> I would like to share an idea that I thought would make snippets even
> more useful.
>
> Rather than always calling a snippet as a single, self-closing tag:
>
> <r:snippet name="my-snip"/>
>
> You could call it as a pair of tags, with content in between:
>
> <r:snippet name="my-snip">
> <p>Lorem ipsum dolor sit amet...</p>
> </r:snippet>
>
> The snippet itself could optionally call <r:yeild/>. If this tag
> occurs anywhere in the snippet, it would be replaced with the content
> appearing between the open/close tags which call the snippet.
>
> An example:
>
> <div class="top-left">
> <div class="top-right">
> <div class="bottom-left">
> <div class="bottom-right">
> <r:yeild/>
> </div>
> </div>
> </div>
> </div>
>
> In this case, the `<r:snippet>` opening tag would correspond to the
> four opening div tags, and the `</r:snippet>` closing tag would
> correspond to the four closing div tags.
>
> I have thought about achieving the same markup by writing two separate
> snippets, and calling from my layout:
>
> <r:snippet name="open-four-divs">
> <p>Lorem ipsum dolor sit amet...</p>
> <r:snippet name="close-four-divs">
>
> But it just looks and feels so wrong!
>
> I'd like to hear what you think about the idea. Could you see a use
> for it? Would it be difficult to implement? Does Radiant already do
> this, and I just didn't realise?
>
> Cheers,
>
> Drew
> _______________________________________________
> Radiant mailing list
> Post: Radiant at lists.radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site: http://lists.radiantcms.org/mailman/listinfo/radiant
>
>
More information about the Radiant
mailing list