Zend Framework Tutorial
Posted: Mon Dec 03, 2007 8:50 am
Ok, yes, I have googled it. Thats the problem, there is nothing concise and to the point. I am looking for tutorials to get me started using Zend Framework but everything out there is so scattered and skips basic questions. Questions I have:
How to set variables that will be used in your "view" from your controller (obviously). I have this:
But that just gives me an error about unable to find the file even though it is there. Frustration levels are high.
Next is how to setup a database connection. I have tried all examples I have found, none seam to work because whenever I try to load something from a model class that extends Zend_Table (or whatever it is), I get an error. I googled the error and none of the fixes worked so I scraped it. I just want to be able to be able to connect to the db though the bootstrap and use a model in my controler like so:
and also, I would like to load all of my classes in the __construct but this does not seam to work because if I give one of my controllers a construct Zend dies. Frustration levels++
There are some other things but these are the most basic for right now. Sorry I don't have all of the "I tried these examples" links but they have been lost in the confusion of everything I have tried. They are the basic first hits on google.
Maybe I am just using the wrong framework? Is there something better?
How to set variables that will be used in your "view" from your controller (obviously). I have this:
Code: Select all
$tmp = Zend_Loader::loadClass('Zend_View');
$tmp = new Zend_View(array('scriptPath' => 'views/scripts/'));
$tmp->test = 'werd';
echo $tmp->render('index.phtml');Next is how to setup a database connection. I have tried all examples I have found, none seam to work because whenever I try to load something from a model class that extends Zend_Table (or whatever it is), I get an error. I googled the error and none of the fixes worked so I scraped it. I just want to be able to be able to connect to the db though the bootstrap and use a model in my controler like so:
Code: Select all
$users = Zend_Loader::loadClass('Users');
$users = new Users;
$all_users = $users->loadAll();//or something like thatThere are some other things but these are the most basic for right now. Sorry I don't have all of the "I tried these examples" links but they have been lost in the confusion of everything I have tried. They are the basic first hits on google.
Maybe I am just using the wrong framework? Is there something better?