-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
37 lines (32 loc) · 905 Bytes
/
index.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
<?php
// if you're using Composer you probably won't need all this
require dirname(__FILE__) . '/../Slim/Slim/Slim.php';
require 'SlimC.php';
require 'controllers/ExampleController.php';
\Slim\SlimC::registerAutoloader();
$app = new \Slim\SlimC(array(
'controller.namespace' => '\\Example\\Controllers',
'templates.path' => 'views'
));
$app->get('/', function() {
echo 'Try it out: <a href="/example">controller root</a> | ' .
'<a href="/example/page">controller page</a> | ' .
'<a href="/example/page/var">controller page with a var</a>';
});
$app->controller(
'/example',
'ExampleController',
array(
'GET /' => 'getIndex',
'GET /page' => 'getPage',
'GET,POST /page/:var' => 'getPageWithVar'
)
);
$app->controller(
'/other_example',
'ExampleController',
array(
'GET /' => 'getSecondIndex'
)
);
$app->run();