[Radiant] Custom Tags and Code reuse

Michael Jones mjfreshnspamfree at gmail.com
Tue Jan 16 13:04:50 CST 2007


> To call out to another tag you can call render on a tag binding:
>
>    tag 'child_urls' do |tag|
>      tag.render('children:each', 'limit' => '5') do
>        tag.render('url')
>      end
>    end

Thanks that really helped, one other question:

How do I pass locals into a tag I'm rendering from another tag?

For example I want to create my own custom tag that dynamically
generates the values for the <r:navigation> tag.

It would go something like:

  tag 'navigation_dynamic' do |tag|
    #some code to generate string of urls
    tag.render('navigation', 'urls' => 'url string here')
  end

The 'navigation_dynamic' would have the nested values that the
'navigation' tag expects, but how do I pass those in?

Thanks-
Michael



More information about the Radiant mailing list