Hi Matthew,

thanks for the answer, but I still have problems.

I try the code that you send me and it still route all pages to indexAction in the indexController.

I'm using the latest stable release downloaded from:
http://framework.zend.com/download/stable

filename: ZendFramework-0.2.0.tar.gz

Here was my bootstrap file:
==============================================
<?php
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set('America/Sao_Paulo');

set_include_path('.' . PATH_SEPARATOR . './library/' . PATH_SEPARATOR . './application/models');
include "Zend.php";

function __autoload($class) {
   Zend::loadClass($class);
}

// register the input filters
Zend::register('post', new Zend_Filter_Input($_POST));
Zend::register('get', new Zend_Filter_Input($_GET));

// load configuration
$config = new Zend_Config_Ini('./application/config.ini', 'general');
Zend::register('config', $config);

// setup database
$db = Zend_Db::factory($config->db->adapter, $config->db->config->asArray());
Zend_Db_Table::setDefaultAdapter($db);
Zend::register('db', $db);

// register the view we are going to use
$view = new Zend_View();
$view->setScriptPath('./application/views');
Zend::register('view', $view);

// setup controller
//Zend_Controller_Front::run('./application/controllers'); //  don't work too.
$router = new Zend_Controller_RewriteRouter();
$ctrl   = new Zend_Controller_Front();
$ctrl->setRouter($router)
     ->setControllerDirectory('./application/controllers');
$ctrl->dispatch();

====================================

Thanks again.

Lucas.

Citando Matthew Weier O'Phinney <[EMAIL PROTECTED]>:

-- Lucas Roxo Mundim <[EMAIL PROTECTED]> wrote
(on Wednesday, 08 November 2006, 10:01 PM -0200):
why this not work?

Zend_Controller_Front::run('./application/controllers');

All pages are routed to indexAction in the indexController.

I have tried this:
$router = new Zend_Controller_RewriteRouter();
$ctrl = Zend_Controller_Front::getInstance();
$ctrl->setRouter($router);
$ctrl->run('./application/controllers');

And I get:

Fatal error: Call to undefined method Zend_Controller_Front::getinstance()

I get that after upgraded from 0.1.5 to 0.2

Based on the above, it sounds like you're using the MVC implementation
in the incubator, as getInstance() was removed in that implementation.

The first example you gave (Zend_Controller_Front::run()) *should* run;
if it does not, please checkout the most current subversion revision and
try it. (I've tried a couple different variations on my local box, and
dispatching to different controllers works.)

For the second example, try this:

    $router = new Zend_Controller_RewriteRouter();
    $ctrl   = new Zend_Controller_Front();
    $ctrl->setRouter($router)
         ->setControllerDirectory('./application/controllers');
    $ctrl->dispatch();

Note that run() should not be used with an already instantiated object
instance; use dispatch() instead. Also, note that you need to set the
controller directory in a separate step; however, because fluid
interfaces were added in the new release, you can do several such setup
measures chained together, as shown above.

Finally, as reported earlier in this thread, it may be that the rewrite
router is having difficulty determining the rewrite base; if so,
explicitly set it prior to dispatching the front controller.

--
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/



Reply via email to