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
- def photos
-
@photos = Photo.find(:all, :limit => 3, :order => 'rand()')
-
render :template=>"photos.xml"
- 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