In Rails we can say:
respond_to do |format|
format.html
format.xml { render :xml => @people.to_xml }
end
which basically means: ‘if format == “xml”’ then show the view named “something.xml” (or just render plain XML like here"
else show the normal html view.
Is something like this built-in in Yii or do I have to extend the Controller and check the UserAgent and do the magic somehow by myself?
What are your design patters for this if you have a web-app that is re-using the same controllers for a normal web application and an iPhone one that will be using json or xml ?
Thanks!