Different view format

In Rails we can say:

respond_to do |format|


  format.xml { render :xml => @people.to_xml }


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 ?


I think you need something like this http://www.yiiframework.com/doc/guide/1.1/en/topics.url#faking-url-suffix .