Forum: Radiant CMS Where to put helper methods for tags?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Kaleb Walton (Guest)
on 2007-01-28 23:23
(Received via mailing list)
Where is an appropriate place to put helper methods for tags to
support the DRY principle?
Daniel S. (Guest)
on 2007-01-29 01:33
(Received via mailing list)
Tags are instance_eval'd on the page, so depending on how your page
hierachy either put them as a method on a superclass or put them in a
module which is included in each of the pages.
Kaleb Walton (Guest)
on 2007-01-29 02:29
(Received via mailing list)
Thanks for that explanation!

I ended up creating a MyTags module that included tag definitions as
well as helper methods. For those who may have the same question I did
something like this:

In extensions/my_tags/lib/my_tags.rb:

module MyTags
  include Radiant::Taggable

  def helper_hello

  tag 'hello' do |tag|

In extensions/my_tags/my_tags_extension.rb:

class MyTagsExtension < Radiant::Extension
  version "1.0"
  description "Adds my tags to the global tag library"
  url ""

  def activate
    Page.send :include, MyTags

As you can see my helper method 'helper_hello' is available from within
my tags.

The above technique used to include tags in the global scope was
suggested a few months back in this mailing list and I found it works
out quite nicely.

This topic is locked and can not be replied to.