More Related Content Similar to 2.routing in zend framework 3 (20) More from Razvan Raducanu, PhD (20) 2.routing in zend framework 34. Module/Test/config/module.config.php
………………………………….
return [
'router' => [
'routes' => [
'home' => [
'type' => Literal::class,
'options' => [
'route' => '/',
'defaults' => [
'controller' => ControllerIndexController::class,
'action' => 'index',
],
],
],
///////////////////////////////////////////////
'welcome' => [
'type' => Literal::class,
'options' => [
'route' => '/welcome',
'defaults' => [
'controller' => ControllerWelcomeController::class,
'action' => 'index',
],
],
],
///////////////////////////////
…………………………………………………………………………………………….
6. …………………………………….
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => [
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'test/index/index' => __DIR__ . '/../view/test/index/index.phtml',
'test/welcome/index' => __DIR__ .
'/../view/test/welcome/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
],
…………………………….
10. ……………………………….
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => [
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'test/index/index' => __DIR__ . '/../view/test/index/index.phtml',
'test/welcome/index' => __DIR__ . '/../view/test/welcome/index.phtml',
'test/welcome/contact' => __DIR__ .
'/../view/test/welcome/contact.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
],
11. • Creati fisierul index.html in directorul:
/module/Test/view/test/welcome
si in acesta in care scrieti:
<h1>This is contact page!</h1>
<br/><br/>
<a href="../">Back</a>
http://localhost:8080/contact
12. In fisierul index.html din directorul:
/module/Test/view/test/index
scrieti:
<h1 style="text-align: center;"><font color="red">URA!!!</font></h1>
<br/><br/>
<a href="welcome">Welcome page</a>
<br/><br/>
<a href="contact">Contact page</a>