2010年1月19日星期二

Re: [fw-mvc] Contextswitch->setAutoJsonSerialization(false) - still requires view script

Or use initContext('json').

   -- Mon


On Wed, Jan 20, 2010 at 1:00 PM, Konr Ness <konrness@gmail.com> wrote:
Are you including the ?format=json query parameter in your URL? I believe this is required.

Also, what happens if your init() method had setAutoJsonSerialization(true), or did not call that method at all? Same with calling that method in the myAction()?

It is working fine on one of my projects with just this in the init method:
$contextSwitch = $this->_helper->contextSwitch;
$contextSwitch->addActionContext('add', 'json')->initContext();
And the URL has /format/json appended to it.

Konr Ness

On Fri, Dec 11, 2009 at 6:54 AM, Exception e <exceptione@hotmail.com> wrote:

In my controller I have the following

       function init() {
               $switch = $this->_helper->getHelper('ContextSwitch');
               $switch->addActionContext('my', 'json')
                       ->setAutoJsonSerialization(false);
                       ->initContext();
       }

       function myAction()    {

$this->_helper->contextSwitch->setAutoJsonSerialization(true);
              $this->view->thing = ...

             // Hey, it still asks for a my.json.phtml file???!!!
       }


Why does myAction still ask for a my.json.phtml  view script?
--
View this message in context: http://n4.nabble.com/Contextswitch-setAutoJsonSerialization-false-still-requires-view-script-tp961030p961030.html
Sent from the Zend MVC mailing list archive at Nabble.com.


没有评论: