diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index fddf83f..276ddba 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -11,6 +11,24 @@ public function init() public function indexAction() { // action body + $dbconf = new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini','development'); + $db = Zend_Db::factory($dbconf->database); + + Zend_Db_Table_Abstract::setDefaultAdapter($db); + Zend_Registry::set('db',$db); + + require_once APPLICATION_PATH . '/models/User.php'; + + $user = new Users(); // Users Table Object. + $rowset = $user->fetchAll()->toArray(); + $list_of_users = array(); + + foreach($rowset as $row) { + $list_of_users[] = $row->id; + } + //$this->view->userlist + $this->view->id = 2; + } public function ajaxAction() diff --git a/application/models/User.php b/application/models/User.php new file mode 100644 index 0000000..e9c1877 --- /dev/null +++ b/application/models/User.php @@ -0,0 +1,16 @@ +
  • tab1
  • tab2
  • + id;?> \ No newline at end of file diff --git a/public/index.php b/public/index.php index f97f1c6..4fd1b0e 100644 --- a/public/index.php +++ b/public/index.php @@ -14,9 +14,22 @@ get_include_path(), ))); +// Include models +set_include_path(implode(PATH_SEPARATOR, array( + realpath(APPLICATION_PATH . '/models'), + get_include_path(), +))); + /** Zend_Application */ require_once 'Zend/Application.php'; +/* + +$dbconf = new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini','development'); +$db = Zend_Db::factory($dbconf->database); +Zend_Db_Table_Abstract::setDefaultAdapter($db); +Zend_Registry::set('db',$db); +*/ // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV,