In order to get your nested tags to render, you have to call
tag.expand. Like so:
module CDateTags
include Radiant::Taggable
tag 'cdate' do |tag|
d1 = tag.locals.d1 = Time.now
tag.locals.d3 = d1.strftime('%y%m%d%H%M%S')
tag.locals.d2 = d1.strftime('%y%m%d')
tag.expand
end
tag 'cdate:creation' do |tag|
tag.locals.d2
end
tag 'cdate:transmission' do |tag|
tag.locals.d2
end
tag 'cdate:transfer' do |tag|
tag.locals.d3
end
end
Or are you trying to use Radius outside of Radiant? If so, what you
have should work, just make sure to call tag.expand and set tag.locals.
Sean
Shakthi Kannan wrote:
Hi,
Is this the right place to ask questions about Radius tags?
I am still reading and trying to understand Radius tags. I have something like:
=== SNIPPET ===
context.define_tag 'cdate' do |tag|
d1 = Time.now
d3 = d1.strftime(%y%m%d%H%M%S)
d2 = d1.strftime(%y%m%d)
end
context.define_tag 'cdate:creation' do |tag|
tag.locals.d2
end
context.define_tag 'cdate:transmission' do |tag|
tag.locals.d2
end
context.define_tag 'cdate:transfer' do |tag|
tag.locals.d3
end
print parser.parse('r:cdate:creation /')
print parser.parse('r:cdate:transmission /')
print parser.parse('r:cdate:transfer /')
=== END ===
1. In all three print instances, whatever is returned from 'cdate'
definition alone is printed, even though I am using the nested tags.
For example, in the above, the value of 'd2' is printed in all three
instances. I am trying to define a general template, and based on
inputs, print the appropriate values.
2. 'creation' and 'transmission' tags return the same variable. How
can I define tags that perform the same functions, without having to
create separate definitions for each?
Appreciate any help in this regard,
Thanks!
SK
___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant