View Single Post
  #1 (permalink)  
Old 12-18-2007, 05:49 PM
jrh jrh is offline
Junior Member
 
Join Date: Dec 2007
Posts: 2
Default view/controller help

What is the best way to make calls to different actions in the same page? On my index page I may want to call sayhiAction within that page.

Also, what is the best way to use Zend_View in the case where noViewRenderer = true.

My index controller looks like this, should I extend Zend_View so I don't have to set the script path in every action or is there a better way to do this?

PHP Code:
class IndexController extends Zend_Controller_Action
{
    public function 
indexAction()
    {
        
$view = new Zend_View();
        
$view->setScriptPath('../application/views/scripts');
        
$view->title "Welcome";
        
$view->content "Hello, World!";
        echo 
$view->render('main.phtml');
    }
    
    public function 
redirectAction(){
        
$this->_redirect('/');
    }

    public function 
sayhiAction(){
        return 
"Hi";
    }

Thanks for the help.

Last edited by jrh : 12-18-2007 at 05:53 PM.
Reply With Quote