Hi,

I'm now having a problem with the <r:random> tag for inserting a
random image into a snippet.

I've looked at
http://dev.radiantcms.org/radiant/browser/trunk/radiant/app/models/page_context.rb
where I see:

# <r:random>
#   <r:option>...</r:option>
#   <r:option>...</r:option>
#   ...
# <r:random>
#
# Randomly renders one of the options specified by the 'option' tags.
#
define_tag 'random' do |tag|
  tag.locals.random = []
  tag.expand
  options = tag.locals.random
  option = options[rand(options.size)]
  option.call if option
end
define_tag 'random:option' do |tag|
  items = tag.locals.random
  items << tag.block
end

It seems to me that the <r:option> tags used in the comments don't
match the line

define_tag 'random:option' do |tag|

and so I tried <r:random:option> instead, but to no avail.

Here is the snippet:

<div class="randomimage">
<a href="/"><img alt="This is a random image" height="100" width="600"
src="/images/banners/
<r:random>
<r:random:option>banner1</r:random:option>
<r:random:option>banner2</r:random:option>
</r:random>
.jpg" /></a>
</div>

TIA,

-- 
Regards,
Dave
_______________________________________________
Radiant mailing list
[email protected]
http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to