Skip to content

Commit 304f5ac

Browse files
authored
Merge pull request #23 from sergeyklay/master
Fixed multi-module example
2 parents c2e2271 + 52e68c7 commit 304f5ac

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -277,17 +277,19 @@ multiple/
277277
│   │   │   └── index.phtml
278278
│   │   └── products
279279
│   │   └── index.phtml
280-
│   ├── frontend
281-
│   │   ├── Module.php
282-
│   │   ├── controllers
283-
│   │   │   ├── IndexController.php
284-
│   │   │   ├── ProductsController.php
285-
│   │   │   └── UsersController.php
286-
│   │   ├── models
287-
│   │   │   └── Products.php
288-
│   │   └── views
289-
│   │   └── products
290-
│   │   └── index.phtml
280+
│   └── frontend
281+
│   ├── Module.php
282+
│   ├── controllers
283+
│   │   ├── IndexController.php
284+
│   │   ├── ProductsController.php
285+
│   │   └── UsersController.php
286+
│   ├── models
287+
│   │   └── Products.php
288+
│   └── views
289+
│   ├── index
290+
│   │   └── index.phtml
291+
│   └── products
292+
│   └── index.phtml
291293
└── public
292294
└── index.php
293295
```

multiple/apps/backend/controllers/LoginController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
class LoginController extends Controller
88
{
9-
109
public function indexAction()
1110
{
12-
$this->view->disable();
1311
}
1412
}

multiple/apps/frontend/controllers/ProductsController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class ProductsController extends Controller
88
{
9-
109
public function indexAction()
1110
{
1211
return $this->response->redirect('login');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h1>Welcome</h1>
2+
3+
<?php echo $this->url->get(['for' => 'frontend', 'controller' => 'index', 'action' => 'index']) ?>

multiple/apps/frontend/views/products/index.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
<?php echo $product->name ?>
44

5-
<?php echo $this->url(['controller' => 'products', 'action' => 'algo']) ?>
5+
<?php echo $this->url->get(['for' => 'frontend-product', 'controller' => 'products', 'action' => 'algo']) ?>

multiple/public/index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ protected function registerServices()
3737
'module' => 'frontend',
3838
'controller' => 1,
3939
'action' => 2,
40-
]);
40+
])->setName('frontend');
4141

4242
$router->add("/login", [
4343
'module' => 'backend',
4444
'controller' => 'login',
4545
'action' => 'index',
46-
]);
46+
])->setName('backend-login');
4747

4848
$router->add("/admin/products/:action", [
4949
'module' => 'backend',
5050
'controller' => 'products',
5151
'action' => 1,
52-
]);
52+
])->setName('backend-product');
5353

5454
$router->add("/products/:action", [
5555
'module' => 'frontend',
5656
'controller' => 'products',
5757
'action' => 1,
58-
]);
58+
])->setName('frontend-product');
5959

6060
return $router;
6161
});

0 commit comments

Comments
 (0)