Hi, I have the following code in my showAction:
PHP Code:
function showAction() {
$this->view->title = "Show Episode";
$episode = new Episode();
$id = 0;
if ( $this->_request->isPost() ) {
Zend_Loader::loadClass('Zend_Filter_Alpha');
$filter = new Zend_Filter_Alpha();
$id = (int)$this->_request->getPost( 'id' );
} else {
$id = (int)$this->_request->getParam( 'id' );
}
if ( $id > 0 ) {
// Only render if we have an id and can find the episode.
$this->view->episode = $episode->find( $id );
if ( $this->view->episode->id > 0 ) {
$this->view->documentRoot = '/public';
$this->view->absolute_update_path = '/public' . '/updates/' . $this->view->episode->update_dir;
return;
}
}
else {
// Redirect to the index page.
$this->_redirect( '/admin/list' );
return;
}
}
However, it renders the associated view (i.e. show.phtml) even if the id doesn't exist in the database. Thus, does anyone see an issue in the code above? BTW, I tried using fetchRow as well and it produced the same result.
Thanks in advance,
-Conrad