File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 66use Mvc5 \Plugin \Callback ;
77use Mvc5 \Session \SessionMessages ;
88use Mvc5 \Service \Context ;
9+ use Plugin \Page ;
910use Plugin \Redirect ;
1011use Psr \Http \Message \ResponseInterface as Response ;
1112use Valar \RedirectResponse ;
9192 'path ' => '/redirect ' ,
9293 'controller ' => new Redirect ('/home ' ),
9394 ],
95+ 'page ' => [
96+ 'path ' => '/page ' ,
97+ 'controller ' => new Page ('home/index ' , ['title ' => 'Demo Page ' ]),
98+ ],
9499 'app ' => [
95100 /*'host' => 'nexus.app.dev',
96101 'port' => 8000,*/
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ *
4+ */
5+
6+ namespace Plugin ;
7+
8+ use Mvc5 \Arg ;
9+ use Mvc5 \Http \Request ;
10+ use Mvc5 \Plugin \Call ;
11+ use Mvc5 \Plugin \Callback ;
12+
13+ class Page
14+ extends Call
15+ {
16+ /**
17+ * @param string $template
18+ * @param array $vars
19+ */
20+ function __construct (string $ template , array $ vars = [])
21+ {
22+ parent ::__construct ([$ this , '__invoke ' ], [$ template , $ vars ]);
23+ }
24+
25+ /**
26+ * @param string $template
27+ * @param array $vars
28+ * @return Callback
29+ */
30+ function __invoke (string $ template , array $ vars )
31+ {
32+ return new Callback (function (Request $ request ) use ($ template , $ vars ) {
33+ return $ this ->plugin (Arg::VIEW_MODEL , [$ template , $ vars + [Arg::REQUEST => $ request ]]);
34+ });
35+ }
36+ }
Original file line number Diff line number Diff line change 77
88?>
99<div class="jumbotron">
10- <h1><a href="<?= $ this ->url ('home ' ) ?> "><?= $ this ->title () ?> </a></h1>
10+ <h1><a href="<?= $ this ->url ('home ' ) ?> "><?= $ this ->title ?> </a></h1>
1111 <p class="lead"><?= $ this ['message ' ] ?> </p>
1212 <pre><?= __FILE__ ; ?> </pre>
1313 <div id="ajax-result"></div>
1414 <p>
1515 <a class="btn btn-primary btn-lg" href="#" role="button" onclick="return info();">Info</a>
1616 <a class="btn btn-primary btn-lg" href="#" role="button" onclick="return about();">About</a>
1717 <a class="btn btn-primary btn-lg" href="#" role="button" onclick="return demo();">Demo</a>
18+ <a class="btn btn-primary btn-lg" href="/page" role="button">Page</a>
1819 <a class="btn btn-primary btn-lg" href="/redirect" role="button">Redirect</a>
1920 </p>
2021</div>
You can’t perform that action at this time.
0 commit comments