-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
53 lines (42 loc) · 1014 Bytes
/
index.php
File metadata and controls
53 lines (42 loc) · 1014 Bytes
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
50
51
52
53
<?php
//FlightPHP
require 'flight/Flight.php';
//########### Configurações
Flight::set('BASE', 'http://localhost/flight-frameowrk/projeto02/');
Flight::set('TITULO', 'Novo Site');
//########### URLs
Flight::route('/',function(){
Flight::render('home.php',
array(
'base' => Flight::get('BASE'),
'titulo' => Flight::get('TITULO')
));
});
Flight::route('/home',function(){
Flight::render('home2.php',
array(
'base' => Flight::get('BASE'),
'titulo' => "Titulo diferente"
));
});
Flight::route('/blog/@post',function($post){
if($post == "novo"){
$texto = "Novo post";
}else{
$texto = "Não e novo";
}
Flight::render('blog.php',
array(
'base' => Flight::get('BASE'),
'titulo' => "Titulo diferente",
'texto' => $texto
));
});
//########### Pagina não encontrada
Flight::map('notFound', function(){
Flight::render('404.php',
array(
'base' => Flight::get('BASE')
));
});
Flight::start();