I am building a ZF2 application called "EcommerceUI". This application, tries to make use of multiple sub modules like, "LogsUI", "ReportsUI" etc.. My structure is as under:
ecommerce-ui
-->config
-->data
-->module
-->EcommerceUI
-->LogsUI
-->ReportsUI
-->public
-->js
-->css
-->images
-->.htaccess
-->index.php
-->vendor
-->ThirdPartyModule1
-->ThirdPartyModule2
How do I create the routing such that:
http://ecommerceui -> goes to ecommerceui/ecommerceui/index
http://ecommerceui/logsui -> goes to ecommerceui/logs/index
Also, how can I make each module share JS, CSS, Images in the public folder?
You need to have your routes set up correctly in your module.config.php file.
This page in the ZF2 User Guide guides you through the process of setting up routes: http://framework.zend.com/manual/2.0/en/user-guide/routing-and-controllers.html
In ecommerce-ui/module/LogsUI/config/module.config.php the routes should be something like this:
<?php
return array(
'controllers' => array(
'invokables' => array(
'LogsUI\Controller\LogsUI' => 'LogsUI\Controller\LogsUIController',
),
),
'router' => array(
'routes' => array(
'logsui' => array(
'defaults' => array(
'controller' => 'LogsUI\Controller\LogsUI',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'logsui' => __DIR__ . '/../view',
),
),
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.