-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.php
49 lines (42 loc) · 1.14 KB
/
routes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
class routes extends mpmvcRouter
{
//add custom route handlers and override defaults here
public function home()
{
echo 'overriding home route';
}
public function about()
{
echo 'heres an about page';
}
public function showPerson()
{
$id = $this->get('PARAMS["id"]');
$person= new Person();
$micropost = new Micropost();
$instance = $person->load($id);
$output = $person->renderItem($id, 'personView');
$posts = $micropost->find('Person_id', $id);
$postlist = '';
foreach($posts as $post)
{
$postlist .= $output->copy('micropost')
->replace('base_url', $this->app->baseurl)
->replace('pid', $post->id)
->replace('ptitle', $post->title);
}
echo $this->app->render($output->replace('micropost', $postlist));
}
}
$app->setRoutesHandler(new routes());
$app->setRoutes(array(
//define additional routes here
'GET /about' => 'about',
'GET /people/@id' => 'showPerson'
));
$app->secureRoutes(array(
'edit',
'new',
'remove'
));