Skip to content

Instantly share code, notes, and snippets.

@zombor
Created November 5, 2012 02:32
Show Gist options
  • Save zombor/4014977 to your computer and use it in GitHub Desktop.
Save zombor/4014977 to your computer and use it in GitHub Desktop.
diff --git a/application/bootstrap.php b/application/bootstrap.php
index 96b8b19..5cc11d9 100644
--- a/application/bootstrap.php
+++ b/application/bootstrap.php
@@ -103,10 +103,13 @@ Kohana::$log->attach(new Log_File(APPPATH.'logs'));
*/
Kohana::$config->attach(new Config_File);
+Cookie::$salt = 'omg';
+
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
+ 'kostache' => '../../KOstache',
// 'auth' => MODPATH.'auth', // Basic authentication
// 'cache' => MODPATH.'cache', // Caching with multiple backends
// 'codebench' => MODPATH.'codebench', // Benchmarking tool
diff --git a/application/classes/Controller/Welcome.php b/application/classes/Controller/Welcome.php
index 0984eff..bbd7132 100644
--- a/application/classes/Controller/Welcome.php
+++ b/application/classes/Controller/Welcome.php
@@ -4,7 +4,9 @@ class Controller_Welcome extends Controller {
public function action_index()
{
- $this->response->body('hello, world!');
+ $view = new View_Test;
+ $renderer = Kostache_Layout::factory();
+ $this->response->body($renderer->render($view));
}
} // End Welcome
diff --git a/application/classes/View/Test.php b/application/classes/View/Test.php
new file mode 100644
index 0000000..5116a92
--- /dev/null
+++ b/application/classes/View/Test.php
@@ -0,0 +1,8 @@
+<?php
+
+class View_Test
+{
+ public $title = 'Testing';
+
+ public $foo = '<foobar>';
+}
diff --git a/application/templates/partials/foobar.mustache b/application/templates/partials/foobar.mustache
new file mode 100644
index 0000000..496c875
--- /dev/null
+++ b/application/templates/partials/foobar.mustache
@@ -0,0 +1 @@
+World!
diff --git a/application/templates/test.mustache b/application/templates/test.mustache
new file mode 100644
index 0000000..811e2d7
--- /dev/null
+++ b/application/templates/test.mustache
@@ -0,0 +1,3 @@
+Hello {{foo}}!
+
+{{>foobar}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Testing</title>
</head>
<body>
<h1>Testing</h1>
<p>Hello &lt;foobar&gt;!
World!
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment