ไม่ต้องการ render Layout และ/หรือ View ใน Zend Framework หรือ ZF
- roteee's blog
- Login to post comments
- 26 reads
ในบางครั้งเราอาจไม่ต้องการ render view และ/หรือ layout เช่นกรณีเราทำ Ajax Controller ก็ไม่อยากจะแสดง layout รวม อยากแสดงแค่ json หรือ xml เราก็เซตได้ครับ ดังนี้ครับ
โดยแป่ะไว้ที่ action เกี่ยวข้อง หรือ ไว้ใน init() ของ controller ที่เกี่ยวข้องก้ได้ แล้วแต่สะดวกครับ
$this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE);