Hi Joseph, What I usually do is three fold:
1. Add is as the default adapter to Zend_Db_Table for use by all my Zend based Models. This also acts as a Registry by the way, since you can call Zend_Db_Table::getDefaultAdapter() anywhere. 2. Add it to a Registry as would be normal practice. 3. Possibly add it as a Front Controller parameter so you can retrieve it from any controller action using that method. Where possible I prefer 3, simply because I prefer to avoid as many static calls in my controllers as possible. But a Registry works just fine so long as you use it only as needed. Paddy 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 > > ----- Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com OpenID Europe Foundation - Irish Representative -- View this message in context: http://www.nabble.com/Dumb-Question-tp17253025p17269386.html Sent from the Zend Framework mailing list archive at Nabble.com.