This repository was archived by the owner on Apr 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathindex.php
More file actions
47 lines (28 loc) · 1.25 KB
/
Copy pathindex.php
File metadata and controls
47 lines (28 loc) · 1.25 KB
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
<?php
//include cockpit
include_once('cockpit/bootstrap.php');
$app = new Lime\App();
// bind routes
$app->bind("/", function() use($app) {
return $app->render('views/index.php');
});
$app->bind("/posts", function() use($app) {
// $posts = collection('Posts')->find(["public"=>true])->sort(["created"=>1])->toArray();
//get posts with related categories
$posts = cockpit('collections')->populate('Posts', cockpit('collections')->find('Posts'))->toArray();
return $app->render('views/posts.php', ['posts' => $posts]);
});
$app->bind("/pages", function() use($app) {
$posts = collection('Pages')->find(["public"=>true])->sort(["created"=>1])->toArray();
return $app->render('views/pages.php', ['pages' => $posts]);
});
$app->bind("/projects", function() use($app) {
//get projects with related categories
$posts = cockpit('collections')->populate('Projects', cockpit('collections')->find('Projects'))->toArray();
return $app->render('views/projects.php', ['projects' => $posts]);
});
// $app->bind("/article/:title_slug", function($params) use($app) {
// $post = collection('blog')->findOne(["title_slug"=>$params['title_slug']]);
// return $app->render('views/article.php', ['post' => $post]);
// });
$app->run();