make it work today
This commit is contained in:
parent
d4f0cc7866
commit
b8560cf14d
|
@ -4,7 +4,7 @@
|
|||
* Example: 5.3 OOP Anonymous Functions
|
||||
*/
|
||||
|
||||
$app = new Mite(array('debug' => TRUE, 'index' => '/mite/examples/53oop.php'));
|
||||
$app = new Mite(array('debug' => TRUE, 'index' => __FILE__));
|
||||
|
||||
$app->route('/', function() use($app) {
|
||||
$app->view('views/index.tpl.php');
|
||||
|
|
|
@ -7,10 +7,10 @@ class test extends Mite {
|
|||
|
||||
function index()
|
||||
{
|
||||
$this->view('views/index.tpl.php');
|
||||
$this->view('views\index.tpl.php');
|
||||
}
|
||||
}
|
||||
|
||||
$app = new test(array('debug' => TRUE, 'index' => '/mite/examples/extend.php'));
|
||||
$app = new test(array('debug' => TRUE, 'index' => __FILE__));
|
||||
$app->route('/', 'index');
|
||||
$app->run();
|
|
@ -15,13 +15,13 @@
|
|||
<hr/>
|
||||
<h1>MITE</h1>
|
||||
<hr/>
|
||||
./___\.........___ _.................................
|
||||
.)O.o(...|\/|.o.|.|_.....BE small.................... <br/>
|
||||
.\_^_/...|..|.|.|.|_.....be STRONG................... <br/>
|
||||
.."."................................................
|
||||
./___\.........___ _.................................
|
||||
.)O.o(...|\/|.o.|.|_.....BE small.................... <br/>
|
||||
.\_^_/...|..|.|.|.|_.....be STRONG................... <br/>
|
||||
.."."................................................
|
||||
<hr/>
|
||||
<center>A Rapid Prototyping Micro Framework</center>
|
||||
<hr/>
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dp100">
|
||||
|
@ -61,13 +61,13 @@
|
|||
include 'mite.php';
|
||||
</div>
|
||||
</div>
|
||||
<div class="dp100"><h3><a href="#">Download!</a></h3></div>
|
||||
<div class="dp100"><h3><a href="http://code.negative9.net/geoff/mite/raw/master/src/mite.php" target="_NEW">Download!</a></h3></div>
|
||||
<div class="dp100">
|
||||
<hr/>
|
||||
<center>©2011 Mite. All rights reserved.</center>
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
s
|
12
src/mite.php
12
src/mite.php
|
@ -50,8 +50,8 @@ class Mite {
|
|||
'index' => '/index.php',
|
||||
'debug' => 'FALSE',
|
||||
'paths' => array(
|
||||
'views' => __DIR__,
|
||||
'models' => __DIR__
|
||||
'views' => '',
|
||||
'models' => ''
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -90,7 +90,7 @@ class Mite {
|
|||
{
|
||||
preg_match("@^{$url}$@", $request, $matches);
|
||||
|
||||
if(isset($matches[0]) && count($matches[0] > 0))
|
||||
if(isset($matches[0]))
|
||||
{
|
||||
if(is_callable($callback))
|
||||
{
|
||||
|
@ -255,9 +255,13 @@ class Mite {
|
|||
}
|
||||
}
|
||||
|
||||
// check if folder defined
|
||||
$dir = self::options('paths','views');
|
||||
|
||||
include("{$dir}/{$template}");
|
||||
// update path
|
||||
$path = $dir ? "{$dir}/{$template}" : "{$template}";
|
||||
|
||||
include($path);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
|
Loading…
Reference in New Issue