...
Code Block | ||||
---|---|---|---|---|
| ||||
<?php namespace Apps\TodoList\Controller; class ViewController extends \Phpfox_Component { public function process(){ $template = $this->template(); // add your section menus $template->buildSectionMenu('to-do-list', [ 'Browse' => $this->url()->makeUrl('/to-do-list'), 'Create' => $this->url()->makeUrl('/to-do-list/add'), ]); $template->menu('Add To Do', $this->url()->makeUrl('/to-do-list/add')); $id = $this->request()->get('req3'); $browseService = \Phpfox::getService('todo'); $aItem = $browseService->getForBrowse($id); $url = $this->url()->permalink('to-do-list.view', $aItem['task_id'], $aItem['name']); $template ->setTitle($aItem['name']) ->setBreadCrumb($aItem['name'], $url); $template->assign([ 'aItem'=>$aItem, ]); } } |
* Wiki Markup $this-
>request>request()-
>get('req3')* is used to get the third value in the url. For example: [>get('req3') is used to get the third value in the url. For example: http://\{YourSite.com\}/index.php/req1/req2/req3/
]...
In
this
case,
current
url
is:
[http://YourSite.com/index.php/to-do-list/view/todo-id/todo-title
],
so
{{>get('req3')}} will return the id of the Todo List
request()-
>get('req3')
will return the id of the Todo List
...
Code Block | ||||
---|---|---|---|---|
| ||||
$module->addComponentNames('controller', [ 'toto.view' => Controller\ViewController::class, ]) |
Code Block | ||||
---|---|---|---|---|
| ||||
route('to-do-list/view/:id/:name', function () { \Phpfox_Module::instance()->dispatch('todo.view'); return 'controller'; }); |
...