Page 1 of 1
Zend Framework - URL parameter not detected?
Posted: Thu Nov 30, 2006 9:16 pm
by DaveTheAve
Well, I've just started following IBM's "Understanding the Zend Framework" series. I realize it was designed for Zend Framework 0.1.4; thus, I had to add the no norouteAction() and have it call indexAction. The problem i'm having is on the
Controllers, actions, and the URL section. I can access 127.0.0.1/framework/ and it works fine, however, if I access 127.0.0.1/framework/user I don't get a "This is the indexAction." message I'm suppose to be getting.
Yes, I did copy and past right; yes, i did name the files right. I feel that this could be a .htaccess issue.
My current .htaccess is:
Options +FollowSymLinks
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|php)$ index.php
php_value include_path ".;libs/ZendFramework/library"
Note: I had to include Options +FollowSymLinks or the rewrite engine would fail with a 403 error message for some stupid reason.
Posted: Thu Nov 30, 2006 9:49 pm
by John Cartwright
try adding
to your htaccess
Posted: Thu Nov 30, 2006 10:01 pm
by DaveTheAve
I just tried that code several times each with different methods, it didn't work; Thank you for your help though.
Posted: Thu Nov 30, 2006 10:29 pm
by John Cartwright
Whoops, didnt realize something..
What exactly are you putting in the framework folder? Typically your bootstrap should go in the root directory.
Posted: Fri Dec 01, 2006 5:33 am
by DaveTheAve
127.0.0.1/framework/ folder contains:
Code: Select all
libs/
|
---> ZendFramework/
|
--->demos;documentation;incubator;library;scripts;tests;etc.... (Your basic) framework 0.2.0 files
views/
controllers/
.htaccess
index.php
and my include_path has "libs/ZendFramework/library" in it so I don't have to worry about failing include for the framework.
Posted: Fri Dec 01, 2006 3:11 pm
by DaveTheAve
Here is my bootstrap if that helps at all:
Code: Select all
<?php
/* Place Zend Framework in include path */
ini_set('include_path',ini_get('include_path') . ';' . 'libs/ZendFramework/library');
/* Load Zend Framework */
require_once('Zend.php');
/* Set Zend_View */
Zend::loadClass('Zend_View');
$view = new Zend_View();
$view->setScriptPath('views');
Zend::register('view', $view);
/* Set Zend_Controller_Front */
Zend::loadClass('Zend_Controller_Front');
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory('controllers');
$controller->dispatch();
and my .htaccess is now:
Code: Select all
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
Note: Just added view to the registry, 30sex ago.
Posted: Fri Dec 01, 2006 3:38 pm
by DaveTheAve
FIXED IT!
Note: The only reason I'm posting the solution is for other people to know what to do.
If you are running Zend Framework from a subdirectory you
MUST patch your Zend_Controller_Router. However, I want my Zend Framework to remain vanilla so I added an extra 2 lines (+ 1 comment line) to my bootstrap file. Note: This could was tested with Zend Framework 0.2.0. I was told it works in eariler versions and was also told there is word this might be fixed in the next framework release.
The code to add to the bootstrap file:
Code: Select all
/* Patch Zend_Controller_Router to use subdirectorys */
$url = explode ( "/", $_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = str_replace($url[1], "", $_SERVER['REQUEST_URI']);
Posted: Fri Dec 01, 2006 3:41 pm
by Luke
DaveTheAve wrote:Zend Framework 0.2.0.
*fixed
Posted: Fri Dec 01, 2006 3:44 pm
by DaveTheAve
No you didn't, I caught it before you and fixed it.

Thanks though.
Posted: Fri Dec 01, 2006 3:52 pm
by Luke
Strange... I saw your post that said 1.2.0 and my post that said 0.2.0 on the same page...
