NYCPHP Meetup

NYPHP.org

[nycphp-talk] JSON and MVC

Tim Lieberman tim_lists at o2group.com
Wed Jul 22 22:22:28 EDT 2009


On Jul 22, 2009, at 1:23 PM, Mitch Pirtle wrote:

> Agreed - and Joomla does it by allowing you to assign the view as the
> document type. For example, you can create different views for html,
> rss, json output. As well, you can just output directly from the
> controller and exit.
>
> Been too busy with work to play with all the other frameworks out
> there, wanting to take a look at the new Zend framework as well as
> kohana. Wondering how all the other frameworks tackle this issue.

Which MVC frameworks *don't* allow this?

I know for Zend, Symfony, or Cake, it's something roughly like:

function someControllerAction(){
	$foo = someModel();
	header("Content-Type: ...");
	$foo->getSomethingIterableOrSomething->to[CSV|JSON|Something]();
	die();
}



More information about the talk mailing list