Re: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9.
From viewing you bootstrap I found 2 quick eyecatcher... Zend::loadClass has been changed to Zend_Loader::loadClass Zend::register has also changed (Zend_Registy::register ??) Greetings Thomas - Original Message - From: ZegeeDotCom [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, March 19, 2007 8:41 PM Subject: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9. My bootstrap file: error_reporting(E_ERROR|E_WARNING); define('HREF_BASE','localhost'); date_default_timezone_set('America/New_York'); set_include_path('../phplib'.'.'. PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path()); function bootstrap(){ include Zend.php; // STAGE 1. Prepare the front ( primary ) controller Zend::loadClass('Zend_Controller_Front'); $frontController = Zend_Controller_Front::getInstance(); $frontController-setControllerDirectory('../application/controllers'); //dispatch actions of the selected controllers $frontController-returnResponse(true); //initialize views Zend::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); Zend::register('view',$view); //STAGE 2. Load configuration options Zend::loadClass('Zend_Config_Ini'); $config = new Zend_Config_InI('../application/config/config.ini','general'); Zend::register('config',$config); //STAGE 3. Load POST / GET Zend::loadClass('Zend_Filter_Input'); Zend::register('post', new Zend_Filter_Input($_POST,false)); Zend::register('get', new Zend_Filter_Input($_GET,false)); //STAGE 4. Set up LOGGING require_once 'Zend/Log.php'; require_once 'Zend/Log/Adapter/File.php'; // File log adapter Zend_Log::registerLogger(new Zend_Log_Adapter_File('../logs/errors.txt')); //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); // dunning the configured MVC program //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); } bootstrap(); and here is my indexcontroller : public function indexAction() { $view = Zend::registry('view'); $post=Zend::registry('post'); $view-title='Find a personal trainer and a gym today!'; $loginid=trim($post-noTags('loginid')); $view-pageid='home'; $view-loginid=$loginid; $view-header='main_header.tpl.php'; $view-footer='main_footer.tpl.php'; $view-actiontemplate ='index.tpl.php'; $view-htmlbase='http://www.zegee.net'; $view-index_headline='index_headline.tpl.php'; $view-index_news='index_news.tpl.php'; $view-index_packages='index_packages.tpl.php'; $view-index_analysis='index_analysis.tpl.php'; $view-index_client_trainer_gym='index_client_trainer_gym.tpl.php'; $this-_response-setBody($view-render('index_template.tpl.php')); } The above works, but how do I convert it to 0.9 ? Thank you Rob Marscher wrote: ZegeeDotCom schreef: I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! Unless you really need something in the latest version, it's probably better to stick with what you have working and wait until 1.0 to update/rewrite your code. I'm sure when 1.0 comes around there will a lot more updated documentation (then again, it won't if none of us help). But it's hard to keep up with all of the documentation (or decide to take the time to improve it) with the API changing and subject to change. -- View this message in context: http://www.nabble.com/Clear-example-of-full-working-bootstrap-please-tf3427918s16154.html#a9559151 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9.
Zend_Registry::set - Original Message - From: Thomas Weidner [EMAIL PROTECTED] To: ZegeeDotCom [EMAIL PROTECTED]; fw-general@lists.zend.com Sent: Monday, March 19, 2007 1:18 PM Subject: Re: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9. From viewing you bootstrap I found 2 quick eyecatcher... Zend::loadClass has been changed to Zend_Loader::loadClass Zend::register has also changed (Zend_Registy::register ??) Greetings Thomas - Original Message - From: ZegeeDotCom [EMAIL PROTECTED] To: fw-general@lists.zend.com Sent: Monday, March 19, 2007 8:41 PM Subject: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9. My bootstrap file: error_reporting(E_ERROR|E_WARNING); define('HREF_BASE','localhost'); date_default_timezone_set('America/New_York'); set_include_path('../phplib'.'.'. PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path()); function bootstrap(){ include Zend.php; // STAGE 1. Prepare the front ( primary ) controller Zend::loadClass('Zend_Controller_Front'); $frontController = Zend_Controller_Front::getInstance(); $frontController-setControllerDirectory('../application/controllers'); //dispatch actions of the selected controllers $frontController-returnResponse(true); //initialize views Zend::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); Zend::register('view',$view); //STAGE 2. Load configuration options Zend::loadClass('Zend_Config_Ini'); $config = new Zend_Config_InI('../application/config/config.ini','general'); Zend::register('config',$config); //STAGE 3. Load POST / GET Zend::loadClass('Zend_Filter_Input'); Zend::register('post', new Zend_Filter_Input($_POST,false)); Zend::register('get', new Zend_Filter_Input($_GET,false)); //STAGE 4. Set up LOGGING require_once 'Zend/Log.php'; require_once 'Zend/Log/Adapter/File.php'; // File log adapter Zend_Log::registerLogger(new Zend_Log_Adapter_File('../logs/errors.txt')); //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); // dunning the configured MVC program //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); } bootstrap(); and here is my indexcontroller : public function indexAction() { $view = Zend::registry('view'); $post=Zend::registry('post'); $view-title='Find a personal trainer and a gym today!'; $loginid=trim($post-noTags('loginid')); $view-pageid='home'; $view-loginid=$loginid; $view-header='main_header.tpl.php'; $view-footer='main_footer.tpl.php'; $view-actiontemplate ='index.tpl.php'; $view-htmlbase='http://www.zegee.net'; $view-index_headline='index_headline.tpl.php'; $view-index_news='index_news.tpl.php'; $view-index_packages='index_packages.tpl.php'; $view-index_analysis='index_analysis.tpl.php'; $view-index_client_trainer_gym='index_client_trainer_gym.tpl.php'; $this-_response-setBody($view-render('index_template.tpl.php')); } The above works, but how do I convert it to 0.9 ? Thank you Rob Marscher wrote: ZegeeDotCom schreef: I was so happy with the 0.7 and 0.8 versions but now I am seeing that the more you do the less I will be able to learn!!! Unless you really need something in the latest version, it's probably better to stick with what you have working and wait until 1.0 to update/rewrite your code. I'm sure when 1.0 comes around there will a lot more updated documentation (then again, it won't if none of us help). But it's hard to keep up with all of the documentation (or decide to take the time to improve it) with the API changing and subject to change. -- View this message in context: http://www.nabble.com/Clear-example-of-full-working-bootstrap-please-tf3427918s16154.html#a9559151 Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Here is my 0.8 version. Please help me convert it to 0.9.
* At the top of your bootstrap, include both 'Zend/Loader.php' and 'Zend/Registry.php' instead of 'Zend.php' * Rewrite all instances of Zend::loadClass(xxx) to Zend_Loader::loadClass(xxx) [However - read the tip in the documentation. loadClass has no real benefit if your class is not a variable. You'd be better off with a require_once] * Rewrite all instances of Zend::register(xxx, yyy) to Zend_Registry::set(xxx, yyy) * Rewrite all instances of Zend::registry(xxx) to Zend_Registry::get (xxx) * The Zend_Filter_Input class has been deprecated - for the moment you'll have to do without it (no complaining! there's already been enough and a solution is on the way) * If there's no post-processing of your response required, you may wish to set preferences prior to execution and have it auto-render:- Replace:- //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); With:- require_once('Zend/Controller/Response/Http.php'); $response = new Zend_Controller_Response_Http(); $response-renderExceptions(true); $frontController-setResponse($response); $frontController-dispatch(); * Why are you enclosing all of your bootstrap within a function call? If you aren't getting any output, you may wish to set breakpoints before and after your view render() to ensure program execution is flowing as expected. There's nothing too tricky about your code so I shouldn't imagine after the above changes you'll have too much trouble. Re: documentation, it's all there currently and I believe you're being overly-harsh. After all, not only does it exist (and with 0.9- specific code in there) but it also exists in over 10 languages! I think the problem is more that you've grown accustomed to the pre 0.9 code and have been bitten by some API changes that make it seem a lot worse than it is. I can happily say I've had to change some apps 3 times since 0.1.5 but each upgrade has helped me streamline and refactor my code into something a lot better. Have fun! My bootstrap file: error_reporting(E_ERROR|E_WARNING); define('HREF_BASE','localhost'); date_default_timezone_set('America/New_York'); set_include_path('../phplib'.'.'. PATH_SEPARATOR . '../library/' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path()); function bootstrap(){ include Zend.php; // STAGE 1. Prepare the front ( primary ) controller Zend::loadClass('Zend_Controller_Front'); $frontController = Zend_Controller_Front::getInstance(); $frontController-setControllerDirectory('../application/ controllers'); //dispatch actions of the selected controllers $frontController-returnResponse(true); //initialize views Zend::loadClass('Zend_View'); $view = new Zend_View(); $view-setScriptPath('../application/views'); Zend::register('view',$view); //STAGE 2. Load configuration options Zend::loadClass('Zend_Config_Ini'); $config = new Zend_Config_InI('../application/config/config.ini','general'); Zend::register('config',$config); //STAGE 3. Load POST / GET Zend::loadClass('Zend_Filter_Input'); Zend::register('post', new Zend_Filter_Input($_POST,false)); Zend::register('get', new Zend_Filter_Input($_GET,false)); //STAGE 4. Set up LOGGING require_once 'Zend/Log.php'; require_once 'Zend/Log/Adapter/File.php'; // File log adapter Zend_Log::registerLogger(new Zend_Log_Adapter_File('../logs/ errors.txt')); //STAGE 3. Find the right action and execute it $response = $frontController-dispatch(); // dunning the configured MVC program //STAGE 7. Render the results in response to request. $response-renderExceptions(true); $response-sendResponse(); } bootstrap(); and here is my indexcontroller : public function indexAction() { $view = Zend::registry('view'); $post=Zend::registry('post'); $view-title='Find a personal trainer and a gym today!'; $loginid=trim($post-noTags('loginid')); $view-pageid='home'; $view-loginid=$loginid; $view-header='main_header.tpl.php'; $view-footer='main_footer.tpl.php';