« Return to Thread: Dumb Question

Re: Dumb Question

by Jim Scherer :: Rate this Message:

Reply to Author | View in Thread

if you are using Zend_Controller_Front as I am you can set it as a parameter:

$frontController = Zend_Controller_Front::getInstance();
$frontController->setParam('db', $db)

and then in your controller:

$this->getFrontController()->getParam('db')

So many ways to skin a cat.

Jim

Joseph Crawford wrote:
In my index.php bootstrap file I setup the database connection into a  
variable $db.  Now I need to access this in other controllers.  This  
seems like a dumb question to me but do I need to global $db; before I  
can access it in the indexAction method of the controller or is it in  
the global scope by default?

Thanks,
Joseph Crawford

 « Return to Thread: Dumb Question