diff --git a/README.md b/README.md
index e69de29..6cdc161 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,151 @@
+Lightweight PHP template engine
+===============================
+
+Features
+--------
+ * Fast
+
+ * Powerful
+
+ * Easy
+
+Installing
+----------
+
+@todo
+
+Getting started
+---------------
+
+ * Simple template:
+```
+/base/path/|
+ |_ simple-template.phtml
+ |_ script.php
+```
+```
+
+
+
+
+ = \jmon\TplEngine\View::get('title') ?>
+
+
+ = \jmon\TplEngine\View::get('title') ?>
+
+
+```
+```
+
+```
+```
+
+
+
+
+ hello world!
+
+
+ hello world!
+
+
+```
+ * Template with layout:
+```
+/base/path/|
+ |_ layout.phtml
+ |_ home/index.phtml
+ |_ script.php
+```
+```
+
+
+
+
+ = \jmon\TplEngine\View::get('title') ?>
+
+
+
+ = \jmon\TplEngine\View::content() ?>
+
+
+```
+```
+
+
+= \jmon\TplEngine\View::get('title') ?>
+```
+```
+
+```
+```
+
+
+
+
+ hello world!
+
+
+ hello world!
+
+
+```
+ * Use of partial:
+```
+/base/path/|
+ |_ template.phtml
+ |_ partial.phtml
+ |_ script.php
+```
+```
+
+
+
+
+ = \jmon\TplEngine\View::get('title') ?>
+
+
+ = \jmon\TplEngine\View::get('title') ?>
+
+
+
+```
+```
+
+
+```
+```
+
+```
+```
+
+
+
+
+ hello world!
+
+
+ hello world!
+
+
+
+```
\ No newline at end of file
diff --git a/src/TplEngine/View.php b/src/TplEngine/View.php
index dbbdbfc..d49d82d 100644
--- a/src/TplEngine/View.php
+++ b/src/TplEngine/View.php
@@ -52,6 +52,7 @@ public static function render($template)
self::$contentToRender = $templateContent;
$templateContent = self::requireIntoString(array_pop(self::$templateHeap));
}
+
return $templateContent;
}
@@ -65,32 +66,25 @@ public static function content()
/**
* It saves variable into template engine.
- * @param string $name
+ *
+ *@param string $key
* @param string|int $value
*/
- public static function set($name, $value)
+ public static function set($key, $value)
{
- self::$vars[$name] = $value;
+ self::$vars[$key] = $value;
}
/**
* It gets one variable saved previously.
- * @param string $name
+ *
+ *@param string $key
*
* @return mixed
*/
- public static function get($name)
- {
- return isset(self::$vars[$name]) ? self::$vars[$name] : null;
- }
-
- /**
- * It prints one variable saved previously.
- * @param string $name
- */
- public static function printVar($name)
+ public static function get($key)
{
- echo isset(self::$vars[$name]) ? self::$vars[$name] : '';
+ return isset(self::$vars[$key]) ? self::$vars[$key] : null;
}
/**
diff --git a/test/TplEngine/ViewTest.php b/test/TplEngine/ViewTest.php
index 97be008..0c4d185 100644
--- a/test/TplEngine/ViewTest.php
+++ b/test/TplEngine/ViewTest.php
@@ -22,7 +22,6 @@ public function testViewCanRenderTemplateExtendingLayout()
public function testViewCanRenderVar()
{
View::set('varname', 'varname');
- $this->assertEquals('varname', View::render('testvar.phtml'));
$this->assertEquals('varname', View::render('getvar.phtml'));
}
public function testViewMultiInherit()
diff --git a/test/TplEngine/testviews/getvar.phtml b/test/TplEngine/testviews/getvar.phtml
index b0cb8bb..ddc8e29 100644
--- a/test/TplEngine/testviews/getvar.phtml
+++ b/test/TplEngine/testviews/getvar.phtml
@@ -1 +1 @@
-
+= \jmon\TplEngine\View::get('varname') ?>
diff --git a/test/TplEngine/testviews/one.phtml b/test/TplEngine/testviews/one.phtml
index 7c29555..6d2c2b8 100644
--- a/test/TplEngine/testviews/one.phtml
+++ b/test/TplEngine/testviews/one.phtml
@@ -1 +1 @@
-11
\ No newline at end of file
+1= \jmon\TplEngine\View::content() ?>1
\ No newline at end of file
diff --git a/test/TplEngine/testviews/testvar.phtml b/test/TplEngine/testviews/testvar.phtml
deleted file mode 100644
index 3e40d76..0000000
--- a/test/TplEngine/testviews/testvar.phtml
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file