970_90

Thursday, 11 September 2014

Zend Framework Interview Questions and Answers for Experienced - Page 2

Zend Framework Interview Questions and Answers for Experienced


How to call another action from another Controller
$this->action("action","controller","module");


How to access variables in elements/header.phtml which is set in layout?
Just set the value before the render
$this->newVariable = $value;//Now you can access $this->newVariable in header.phtml
$this->render('elements/header.phtml');

How we can we get all parameter value in layout/view?

$objData = Zend_Controller_Front::getInstance()->getRequest()->getParams();


Question: How to change the viewScriptPath from controller?
$this->view->setScriptPath(APPLICATION_PATH."/views/scripts/newpath");      


How to change the Layout path from controller?
$this->_helper->layout->setLayout(APPLICATION_PATH."/layouts/scripts/newpath");


How can Zend Db be used to update multiple tables using joins?
class Application_Model_SurveyLogs extends Zend_Db_Table_Abstract {
    protected $_name = 'survey_logs';
    protected $_primary = 'id';
    function updateWithMultipleJoin(){            
        $this->getAdapter()->query('UPDATE survey_questions AS sq,survey_logs as sl SET sl.question=sq.name WHERE sq.id=sl.question_id;'); 
    }
}

1 comment: