1
votes

Problem: I see Blank Page

All I want to do is when I type

http://localhost --> Go to modules/default/index

http://localhost/admin --> Go to modules/admin/index

index.php has not important. Common settings

Folder Structure

enter image description here

Bootstrap.php

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initRoutes()
    {
        $front  = $this->getResource('frontcontroller');
        $router = $front->getRouter();
        $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/routes.xml');
        $router->addConfig($config->routes);

    }
}

application.ini

[production]

;Debug output
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0

;Include path
includePaths.library = APPLICATION_PATH "/../library"

;Bootstrap
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

;NameSpace
appnamespace = "Application"

;Front Controller
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

;Modular suport
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =

;resources.frontController.params.prefixDefaultModule = "1"
;resources.frontController.defaultModule = "default"

;Views
resources.view.encoding = "UTF-8"
resources.view.basePath = APPLICATION_PATH "/views/"
;resources.view.doctype = "XHTML1_STRICT" 
resources.view.doctype = "XHTML1_TRANSITIONAL"

Config.xml

<?xml version="1.0" encoding="UTF-8"?>
<router>
    <routes>
        <some-action>
            <type>Zend_Controller_Router_Route</type>
            <route>:module/:controller</route>
            <defaults>
                <controller>index</controller>
                <action>index</action>
            </defaults>
        </some-action>
    </routes>
</router>

default controller

<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }


}

admin controller

<?php

class Admin_IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }


}

.htaccess

SetEnv APPLICATION_ENV development

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

ERROR:

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files (x86)\Zend\ZendServer\share\ZendFramework\library\Zend\Loader\Autoloader.php on line 380

2
please turn on exceptions, and post the erroropHASnoNAME
@ArneRie , Attached error at end of questionPirzada

2 Answers

0
votes

I think you doesn't need an Router Configuration for this case? This is the standard behavoir of Zend Framework.

Iam not sure in the moment, but try to Prefix your IndexController with "Default_":

class Default_IndexController extends Zend_Controller_Action
{

}

If this is not working, please post your ReWrite Rule.

0
votes

try it with the following xml for your routes:

<?xml version="1.0" encoding="UTF-8"?>
<router>
    <routes>
        <front>
            <route>/</route>
            <defaults>
                <module>default</module>
                <controller>index</controller>
                <action>index</action>
            </defaults>
        </front>
        <admin>
            <route>/admin</route>
            <defaults>
                <module>admin</module>
                <controller>index</controller>
                <action>index</action>
            </defaults>
        </admin>
    </routes>
</router>