From b8560cf14d4a8486f3c54d9768698bdbae0fb1a9 Mon Sep 17 00:00:00 2001 From: Geoff Doty Date: Sun, 9 Dec 2018 03:59:38 -0500 Subject: [PATCH] make it work today --- examples/53oop.php | 2 +- examples/extend.php | 4 ++-- examples/views/index.tpl.php | 14 +++++++------- src/mite.php | 12 ++++++++---- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/examples/53oop.php b/examples/53oop.php index 71a2593..8607f1d 100644 --- a/examples/53oop.php +++ b/examples/53oop.php @@ -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'); diff --git a/examples/extend.php b/examples/extend.php index b2e79af..24ff84f 100644 --- a/examples/extend.php +++ b/examples/extend.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(); \ No newline at end of file diff --git a/examples/views/index.tpl.php b/examples/views/index.tpl.php index 8d9d97d..37289d3 100644 --- a/examples/views/index.tpl.php +++ b/examples/views/index.tpl.php @@ -15,13 +15,13 @@

MITE


- ./___\.........___ _................................. - .)O.o(...|\/|.o.|.|_.....BE small....................
- .\_^_/...|..|.|.|.|_.....be STRONG...................
- .."."................................................ + ./___\.........___ _................................. + .)O.o(...|\/|.o.|.|_.....BE small....................
+ .\_^_/...|..|.|.|.|_.....be STRONG...................
+ .."."................................................
A Rapid Prototyping Micro Framework
-
+
@@ -61,13 +61,13 @@ include 'mite.php';
-

Download!

+

Download!


©2011 Mite. All rights reserved.

- + s \ No newline at end of file diff --git a/src/mite.php b/src/mite.php index 1a06090..15eb0d9 100644 --- a/src/mite.php +++ b/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); } /*****************************************************************