La estructura de la aplicacion es la siguiente;
Código HTML:
foro: application -configs -config.php -development.config.php -production.config.php -routes.config.php -controller -layouts -modules -default -controllers -errorController.php -indexController.php -forms -layouts -view -scripts -error.phtml -index..phtml -view -scripts -error.phtml -index..phtml -Bootstrap -public -index.php .htaccess
Código PHP:
<?php
// Define the application path
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define the application environment
if (isset($_SERVER['environment']) && $_SERVER['environment'] === 'development') {
define('APPLICATION_ENV', 'development');
} else {
define('APPLICATION_ENV', 'production');
}
// Set include path to ZF library
set_include_path(implode(PATH_SEPARATOR, array(
dirname(APPLICATION_PATH) . '/library',
get_include_path()
)));
// Initiate Zend_Application
require_once 'Zend/Application.php';
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/config.php'
);
$application->bootstrap()
->run();
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
en mi config.php tengo:
Código PHP:
<?php
return array_merge_recursive(array(
'includePaths' => array(
'library' => APPLICATION_PATH . '/library'
),
'bootstrap' => array(
'path' => APPLICATION_PATH . '/Bootstrap.php',
'class' => 'Bootstrap'
),
'resources' => array(
'frontController' => array(
'moduleDirectory' => APPLICATION_PATH . '/modules'
),
'modules' => array(),
'router' => array(
'routes' => include dirname(__FILE__) . '/routes.config.php'
),
'locale' => array(
'default' => 'en_US',
'force' => true
),
'layout' => array(
'layout' => 'layout',
'layoutPath' => APPLICATION_PATH . '/layouts/scripts'
),
)
), include dirname(__FILE__) . '/' . APPLICATION_ENV . '.config.php');
Código PHP:
<?php
return array(
'phpSettings' => array(
'display_startup_errors' => 1,
'display_errors' => 1,
'error_reporting' => (E_ALL | E_STRICT)
),
'resources' => array(
'frontController' => array(
'baseUrl' => '',
'throwExceptions' => true
)
)
);
Código PHP:
<?php
return array(
'phpSettings' => array(
'display_startup_errors' => 0,
'display_errors' => 0,
'error_reporting' => 0
),
'resources' => array(
'frontController' => array(
'baseUrl' => '',
'throwExceptions' => true
)
)
);
en mi routes.php
Código PHP:
return array(
'home' => array(
'type' => 'Zend_Controller_Router_Route_Static',
'route' => 'home/index',
'defaults' => array(
'module' => 'default',
'controller' => 'home',
'action' => 'index'
)
)
);
Código PHP:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initTimezone()
{
date_default_timezone_set('Europe/Madrid');
}
protected function _initSystemLocale()
{
$this->bootstrap('locale');
setlocale(LC_CTYPE, $this->getResource('locale')->toString() . '.utf-8');
}
/**
* Setup a resource loader for the default module
*
* @return void
*/
protected function _initDefaultResourceLoader()
{
$resourceLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Default',
'basePath' => dirname(__FILE__) . '/modules/default',
));
}
/**
* Setup additional view parameters
*
* @return Zend_View
*/
protected function _initViewEnvironment()
{
$this->bootstrap('view');
$view = $this->getPluginResource('view')->getView();
$view->doctype(Zend_View_Helper_Doctype::XHTML5);
$view->setEncoding('utf-8');
$view->headMeta('', 'utf-8', 'charset');
$request = new Zend_Controller_Request_Http();
}
/**
* Setup a resource loader for the default module
*
* @return void
*/
protected function _initDefaultResourceLoader()
{
$resourceLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Default',
'basePath' => dirname(__FILE__) . '/modules/default',
));
}
protected function _initView()
{
// Initialize view
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$view->headTitle('My First Zend Framework Application');
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
'ViewRenderer'
);
$viewRenderer->setView($view);
// Return it, so that it can be stored by the bootstrap
return $view;
}
/**
* Setup router configuration
*
* @return Zend_Controller_Router_Rewrite
*/
protected function _initRouting()
{
$router = $this->getPluginResource('Router')->getRouter();
$router->removeDefaultRoutes();
return $router;
}
/**
* Set HTTP headers
*
* @return Zend_Controller_Response_Http
*/
protected function _initResponse()
{
$this->bootstrap('frontController');
$response = new Zend_Controller_Response_Http();
$response->setHeader('language', 'en')
->setHeader('content-language', 'en')
->setHeader('Content-Type', 'text/html; charset=utf-8');
$this->getPluginResource('frontController')->getFrontController()
->setResponse($response);
return $response;
}
}
Cuando instaler al principio la aplicacion siguiendo el Quickstart Manual no habia problema y salia la pantalla de Zend que siempre suele salir.
Pero al eliminar el appliacation.ini y querer hacerlo con distintos archivos de configuracion con extension php , sale ese error.
La idea principal es que cuando entre en la aplicacion vaya al module default,
al controllador Home , y a la accion Index.
No se si sera problema del routing.php , del htacces.
Alguna ayuda...muchas gracias