I'm trying to create a wordpress plugin using zend framework 2 ( I'm new to zf ).
I've googled it a lot but I couldn't figure how to get it right with controllers and views.
I have the following directory structure:
zend-plugin
plugin.php
library
- Zend
- config
- application.config.php
- data
- cache
- module
- CMP
- config
- language
- src
- CMP
- controller
- CMP
- view
- CMP
- index
- error
- layout
- CMP
- CMP
- public
plugin.php looks like this:
set_include_path(
implode(PATH_SEPARATOR, array(
get_include_path(),
CMP__PATH,
CMP__PATH . '/library',
)));
$zf2Path = false;
if (is_dir(CMP___LIB_PATH)) {
$zf2Path = CMP___LIB_PATH;
} elseif (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment variable or git submodule
$zf2Path = getenv('ZF2_PATH');
} elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value
$zf2Path = get_cfg_var('zf2_path');
}
if ($zf2Path) {
if (isset($loader)) {
$loader->add('Zend', $zf2Path);
} else {
include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true
)
));
}
}
Zend\Mvc\Application::init(require 'config/application.config.php')->run();
I don't know how to do next to add menu pages or display plugin's dashboard page. It trows this error : 'Module(CMP) could not be initialized'.
Any help, please??
Thanks!
Updated!
Here you can find a solution to this problem. For further information, please let me know.