atl_andy Posted November 26, 2008 Share Posted November 26, 2008 The framework is set up and the index page is being displayed fine. I'm trying to add navigation to the site and have hit a wall. To add the contact.phtml view, I have done the following: 1. Inside IndexController.php - added the contactAction() method. 2. Added contact.phtml to /view/scripts/index 3. Navigated to localhost/index/contact to see the results, but get "URL not found /index/contact" My question: Once the initial site framework is set up, what is the best way to add site navigation? framework layout: |- application |- bootstrap.php |- config |- config.ini |- controllers |- ErrorController.php |- IndexController.php |- data |- db |- models |- logs |- tmp |- views |- layouts |- layout.phtml |- scripts |- error |- error.phtml |- index |- index.phtml |- contact.phtml |- library |- Zend |- public |- index.php |- css Quote Link to comment https://forums.phpfreaks.com/topic/134409-zend-framework-stuck-after-site-setup/ Share on other sites More sharing options...
wrs Posted January 25, 2009 Share Posted January 25, 2009 I'll have to assume that this "URL not found /index/contact" error you are receiving is a 404 error generated by your webserver/browser because it was unable to find the file '<documentroot>/index/contact' on disk. It seems like you have configured your ZF app to handle index/contact correctly, so whats the problem? Probably, it is because you have not instructed your webserver to 'redirect' all requests to your index.php file where they can be correctly handled by your ZF app. For apache webservers, you would make use of the mod_rewrite module which allows you to do the above. In your virtualhost config, or .htaccess, you would want something along the lines of: RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /index.php [NC,L] Basically, this instructs Apache to rewrite all requests which would normally result in a 404 File Not Found back to your index.php for correct handling. There are several ways of doing this, but this is a good starting place. This is actually covered in the ZF Quickstart Guide Quote Link to comment https://forums.phpfreaks.com/topic/134409-zend-framework-stuck-after-site-setup/#findComment-745948 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.