[Radiant] Custom Tags and Code reuse

John W. Long ng at johnwlong.com
Tue Jan 16 07:49:49 CST 2007


Michael Jones wrote:
> In the standard tags module there is alot of useful code however it's
> not encapsulated in classes so I can't really build my custom tags
> upon the existing tags.
> 
> I would really like access to "children:each" and just pass it an
> options hash or something. Am I missing some code somewhere? Is there
> some magic way to reference these tags via your own custom tags or
> classes?

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

> Also is there some good info on the way Tags work, after spending my
> life in methods this syntax seems so odd and I haven't had much luck
> trying to hunt down particular methods in the api.

The basic principles of tag construction are covered in the Radius 
quickstart guide:

http://radius.rubyforge.org/files/QUICKSTART.html

--
John Long
http://wiseheartdesign.com



More information about the Radiant mailing list