I must say I am at my wits' end.
I have the following indexAction() which should return json data. Everything
works on my testing server but it does not work on the production one. Can
someone explain point me to potential underlying reasons.
I know I do not have error.json.phtml. When I put it, I lose the error
message but the json is not produced anyway. Just my layout rendered.
Thank you very much in advance
Michael
public function init()
{
$contextSwitch = $this->_helper->getHelper('contextSwitch');
$contextSwitch->addActionContext('index', 'json')
->initContext();
}
public function indexAction()
{
$query = null;
$sort = 'last_name';
$dir = 'asc';
$startIndex = 0;
$results = 10;
$request = $this->getRequest();
if ($request->isGet()) {
$rqstQuery = $request->getParam('query');
$rqstSort = $request->getParam('sort');
$rqstDir = $request->getParam('dir');
$rqstStartIndex = $request->getParam('startIndex');
$rqstResults = $request->getParam('results');
if (strlen($rqstQuery) > 0) {
$query = $rqstQuery;
}
if (strlen($rqstSort) > 0) {
$sort = $rqstSort;
}
if (strlen($rqstDir) > 0) {
$dir = $rqstDir;
}
if (strlen($rqstStartIndex) > 0) {
$startIndex = $rqstStartIndex;
}
if (strlen($rqstResults) > 0) {
$results = $rqstResults;
}
}
$db = Zend_Registry::get('db');
$where = ' WHERE last_name LIKE \'' . $query . '%\'';
$sql = 'SELECT COUNT(id) AS count FROM participants_personal_data';
if (!is_null($query)) {
$sql .= $where;
}
$stmt = $db->query($sql);
$participant = $stmt->fetch();
if (is_null($query)) {
$where = '';
}
$stmt = $db->query('SELECT id, first_name, last_name, email, cellular,
landline, paid, payment_datetime AS payment_datetime_old, payment_datetime
AS payment_datetime_new, fill_datetime FROM participants_personal_data' .
$where . ' ORDER BY ' . $sort . ' ' . $dir . ' LIMIT ' . $startIndex . ', '
. $results);
$participants = $stmt->fetchAll();
$stmt = $db->query('SELECT price FROM price WHERE CURDATE() BETWEEN `from`
AND `until`');
$current = $stmt->fetch();
for ($i = 0, $j = count($participants); $i < $j; $i++) {
$stmt = $db->query('SELECT price FROM price WHERE DATE(?) BETWEEN `from`
AND `until`', $participants[$i]['fill_datetime']);
$fill = $stmt->fetch();
unset($participants[$i]['fill_datetime']);
$participants[$i]['fill_price'] = $fill['price'];
$participants[$i]['curr_price'] = $current['price'];
}
unset($this->view->module);
unset($this->view->controller);
unset($this->view->action);
$this->view->recordsReturned = count($participants);
$this->view->totalRecords = (integer) $participant['count'];
$this->view->sort = $sort;
$this->view->dir = $dir;
$this->view->startIndex = $startIndex;
$this->view->results = $results;
$this->view->records = $participants;
}
Fatal error: Uncaught exception 'Zend_View_Exception' with message 'script
'error/error.json.phtml' not found in path
(/home/slubn0/application/modules/default/views/scripts/:/home/slubn0/application/modules/perc/views/scripts/:./views/scripts/)'
in /home/slubn0/library/Zend/View/Abstract.php:875
Stack trace:
#0 /home/slubn0/library/Zend/View/Abstract.php(783):
Zend_View_Abstract->_script('error/error.jso...')
#1 /home/slubn0/library/Zend/Controller/Action/Helper/ViewRenderer.php(902):
Zend_View_Abstract->render('error/error.jso...')
#2 /home/slubn0/library/Zend/Controller/Action/Helper/ViewRenderer.php(923):
Zend_Controller_Action_Helper_ViewRenderer->renderScript('error/error.jso...',
NULL)
#3 /home/slubn0/library/Zend/Controller/Action/Helper/ViewRenderer.php(962):
Zend_Controller_Action_Helper_ViewRenderer-
>render()
#4 /home/slubn0/library/Zend/Controller/Action/HelperBroker.php(276):
Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#5 /home/slubn0/library/Zend/Controller/Action.php(513): Zend_Controller_Act
in /home/slubn0/library
/Zend/View/Abstract.php on line 875<br />
--
View this message in context: http://www.nabble.com/Uncaught-exception-%27Zend_View_Exception%27-tp20694887p20694887.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论