Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
How to pass dynmaic value to radiant tag
4 Posts
How to pass dynmaic value to radiant tag


I want to pass dynamic value to radiant tag like

......... ........

but this line " " gave me error. how to pass this value .

How too fix this issue is there is any other option i have n number of files and also admin will add page dynmaiccly so i can't hard code.


Put this tag in app/models/standard_tag.rb file

desc %{

Inside this tag all page related tags refer to the page found at the @url@ attribute.  
@url@s may be relative or absolute paths.


} tag 'find_d' do |tag|

url = tag.attr['url']

raise TagError.new("`find' tag must contain `url' attribute") unless url

# url= tag.locals.page.render('url',url) url= tag.render('url', tag.attr)

 found = Page.find_by_url(absolute_path_for(tag.locals.page.url, url))
if page_found?(found)
  tag.locals.page = found

end and uses

If I recall correctly you cannot use Radiant tags as attributes inside other tags, therefore you need to hardcode the url in the Of course there are other options for finding pages using the children tags which may do what you need to do. There is also the option of making your own tags as Amit has suggested.

Hi Jeffy

Radiant parsing one level if you want to parse tag inside another tag then if you have to write your own method.

"tag.locals.page.render" parse tag return its result dynamic

4 Posts
Login to add your message