Greg, first of all, thanks for the answer, really appriciate it.
I read blog post where controller plugin is used. It's ok, but additional
code is needed, and it's not fully zf compatible.
I want to be able to separate resource config (navigation, routes...), with
possibility to keep most of resource commmon (db, view, autoload, project
specific config...).
Your approach is interesting, if I understand you well, I'll need to have
separate index.php for default and admin, which means repeating some of
this, or placing it in another PHP file:
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) .
'/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ?
getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../..'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()->run();
But i don't understand how the config files will look in this case, and how
I can merge them?
Regards,
Saša Stamenković
On Sat, Jan 30, 2010 at 9:29 AM, Greg <[email protected]> wrote:
> One way to achieve this is to have separate bootstrap index.php files,
> i.e /admin/index.php which would then specify a specific config file
> to use which merges with the main (default module) config. Both
> config.ini specify the default module, and because of merging the two
> configs setting the default module to be admin in the admin config.ini
> will allow you to determine which specific controller directory to
> specify.
>
> $module = isset($options['module']) ? $options['module'] :
> 'default';
>
> $frontController = Zend_Controller_Front::getInstance();
>
>
>
> $frontController->setControllerDirectory(APPLICATION_PATH.'/modules/'.$module.'/controllers',
> $module)
>
> The module Directory is not specified since it will read admin, and
> default as available modules to bootstrap.
>
>
> If you google, Matthew mentioned another method that someone used
> whereby using a controller plugin to only call iniActive methods for
> the current module - but for me that still meant loading a module
> bootstrap class which would wouldn't be required in this particular
> usage.
>