First of all, PLEASE forgive my Zend newbie-ness. I’ve been doing the killerphp.com Zend tutorials and I’ve been some cool stuff but when adding my own ideas, I’m running into a problem with using the _forward command.
I get how _forward is SUPPOSED to work… call forward and designate the action you’re looking for and the specified controller. But it simply won’t work for me, and NO, I’m NOT trying to call _forward in the init( )
Here is my folder structure:
[URL=“http://www.mediabreeze.com/zendFolders.jpg”]http://www.mediabreeze.com/zendFolders.jpg
So this is the class that’s being called:
class VidRequestController extends Zend_Controller_Action {
/* * runs every time * */
public function init() { }
public function indexAction() {
$this->view->instructions = "Please upload a video </br>";
$form = new Zend_Form();
$form->setMethod('post');
$id = $form->createElement('hidden','id');
$videostring = $form->createElement('select','videostring');
// get string to video path
$videostring ->setLabel('Videos:')
->addMultiOptions(array(
'swing1' => 'swing1', 'swing2' => 'swing2', 'swing3' => 'swing3', 'swing4' => 'swing4'
));
$register = $form->createElement('submit','register');
$register->setLabel("Convert Video")
->setIgnore(true);
$form->addElements(array(
$videostring, $id, $register ));
$form->setAction("/videoprocess/");
$this->view->formRender = $form;
}
public function videoDoneAction() {
$this->view->instructions = "Video Done. </br>";
}
}
And this is the class doing the calling :
class VideoProcessController extends Zend_Controller_Action { /* * runs every time * */
public function init()
{
}
public function indexAction() {
$this->view->viewText = "This page receives the video<br />";
//this returns the whole array
// $data = $this->_request->getParams();
//this returns just one element of the array
$vid = $this->_request->getParam('videostring');
$this->view->passedVideo = "<br /><br />Passed video: <i>".$vid."</i>";
$command ="C:/xampp/htdocs/mobilePPC/videos/ffmpeg -i C:/xampp/htdocs/mobilePPC/videos/".$vid.".avi -ab 32 C:/xampp/htdocs/mobilePPC/videos/".$vid.".wmv" ;
$output = exec($command,$output,$return);
$result =($return==0) ? "success" : "failure";
if($this->_request->isPost() ){
$data = array(
"wuci"=> "000-000-000",
"lessonname"=> "mobileLesson1",
"coachname"=> "coach name string",
"videopath"=> $vid,
); }
$lesson = new Lesson();
$lesson->insert($data);
$this->_forward('videoDone','VidRequest');
$this->view->return = "<br /><br />return: ".$result." ";
}
}
And this is the error I’m getting:
exception ‘Zend_Controller_Action_Exception’ with message ‘Action “videodone” does not exist and was not trapped in __call()’ in C:\xampp\php\ZendFramework\library\Zend\Controller\Action.php:485 Stack trace: #0 C:\xampp\php\ZendFramework\library\Zend\Controller\Action.php(518): Zend_Controller_Action->__call(‘videodoneAction’, Array) #1 C:\xampp\php\ZendFramework\library\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch(‘videodoneAction’) #2 C:\xampp\php\ZendFramework\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #3 C:\xampp\htdocs\mobilePPC\html\index.php(54): Zend_Controller_Front->dispatch() #4 {main}
Sorry, I wish I were able to post online but I can’t seem to get the environment working on my server so working in localhost only for now.
Also, I apologize for the code formatting issue, got messed up when I tried to post it here in the forum.