How to render RXML partial within a static XML file?

Hi,

there’s a big static part in the xml i want to output, can i do this
in a “RHTML” way?

i tried to copy the static part and paste into the RXML template, but
it didn’t work.

i tried to to do this inside my XMLController

  1. def photos
  2. @photos = Photo.find(:all, :limit => 3, :order => 'rand()')
    
  3. render :template=>"photos.xml"
    
  4. end

but it won’t work either. do i have to write the static part using the
normal “xml.” way?

thank you.

No you can write static content in your RXML file, just don’t write it
as XML write it as RXML…

So you can do this:

for blah in @blahs
xml.url do
xml.loc(blah_profile_url(blah))
xml.changefreq ‘daily’
xml.lastmod((blah.updated_at).strftime("%Y-%m-%d"))
xml.priority’0.8’
end
end

#Static content pages
xml.url {
xml.loc(‘http://www.blah.com/about/blah’)
xml.changefreq(‘monthly’)
xml.priority(‘0.3’)
}
xml.url {
xml.loc(‘http://www.blah.com/about/blahblah’)
xml.changefreq(‘monthly’)
xml.priority(‘0.3’)
}

But you can do this:
for blah in @blahs
xml.url do
xml.loc(blah_profile_url(blah))
xml.changefreq ‘daily’
xml.lastmod((blah.updated_at).strftime("%Y-%m-%d"))
xml.priority’0.8’
end
end

http://www.blah.com/about/blah
monthly
0.3


http://www.blah.com/about/blah
monthly
0.3

hope this helps,
Cam

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs