make it work today

This commit is contained in:
Geoff Doty 2018-12-09 03:59:38 -05:00
parent d4f0cc7866
commit b8560cf14d
4 changed files with 18 additions and 14 deletions

View File

@ -4,7 +4,7 @@
* Example: 5.3 OOP Anonymous Functions * 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->route('/', function() use($app) {
$app->view('views/index.tpl.php'); $app->view('views/index.tpl.php');

View File

@ -7,10 +7,10 @@ class test extends Mite {
function index() 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->route('/', 'index');
$app->run(); $app->run();

View File

@ -15,13 +15,13 @@
<hr/> <hr/>
<h1>MITE</h1> <h1>MITE</h1>
<hr/> <hr/>
./___\.........___ _................................. ./___\.........___ _.................................
.)O.o(...|\/|.o.|.|_.....BE small.................... <br/> .)O.o(...|\/|.o.|.|_.....BE small.................... <br/>
.\_^_/...|..|.|.|.|_.....be STRONG................... <br/> .\_^_/...|..|.|.|.|_.....be STRONG................... <br/>
.."."................................................ .."."................................................
<hr/> <hr/>
<center>A Rapid Prototyping Micro Framework</center> <center>A Rapid Prototyping Micro Framework</center>
<hr/> <hr/>
</div> </div>
</div> </div>
<div class="dp100"> <div class="dp100">
@ -61,13 +61,13 @@
include 'mite.php'; include 'mite.php';
</div> </div>
</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"> <div class="dp100">
<hr/> <hr/>
<center>&copy;2011 Mite. All rights reserved.</center> <center>&copy;2011 Mite. All rights reserved.</center>
<hr/> <hr/>
</div> </div>
</div> </div>
</body> </body>
</html> </html>
s s

View File

@ -50,8 +50,8 @@ class Mite {
'index' => '/index.php', 'index' => '/index.php',
'debug' => 'FALSE', 'debug' => 'FALSE',
'paths' => array( 'paths' => array(
'views' => __DIR__, 'views' => '',
'models' => __DIR__ 'models' => ''
) )
); );
@ -90,7 +90,7 @@ class Mite {
{ {
preg_match("@^{$url}$@", $request, $matches); preg_match("@^{$url}$@", $request, $matches);
if(isset($matches[0]) && count($matches[0] > 0)) if(isset($matches[0]))
{ {
if(is_callable($callback)) if(is_callable($callback))
{ {
@ -255,9 +255,13 @@ class Mite {
} }
} }
// check if folder defined
$dir = self::options('paths','views'); $dir = self::options('paths','views');
include("{$dir}/{$template}"); // update path
$path = $dir ? "{$dir}/{$template}" : "{$template}";
include($path);
} }
/***************************************************************** /*****************************************************************