Skip to content

Instantly share code, notes, and snippets.

@basz
Created July 3, 2012 13:30
Show Gist options
  • Select an option

  • Save basz/3039707 to your computer and use it in GitHub Desktop.

Select an option

Save basz/3039707 to your computer and use it in GitHub Desktop.
<?php
// module.config.php
return array(
'view_manager' => array(
'strategies' => array(
'ViewJsonStrategy', // register JSON renderer strategy
),
),
);
// SomeController.php
public function indexAction()
{
return new JsonModel(array('some'=>'data'));
}
// or, you can do IF your browser requests json? (jquery), otherwise it will render with the normal php strategy, which can be handy...
public function indexAction()
{
return new ViewModel(array('some'=>'data'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment