Skip to content

Instantly share code, notes, and snippets.

@graphis
Forked from lukemorton/kostache-layout.php
Created November 4, 2012 21:11
Show Gist options
  • Save graphis/4013793 to your computer and use it in GitHub Desktop.
Save graphis/4013793 to your computer and use it in GitHub Desktop.
Basic HTML5 Mustache layout
<?php defined('SYSPATH') or die('No direct script access.');
class Kostache_Layout extends Kohana_Kostache_Layout {
public $app_id;
public $page_id;
public function charset()
{
return Kohana::$charset;
}
public function stylesheets()
{
return array(
array(
'href' => 'css/screen.css',
'media' => 'screen, projector',
),
);
}
public function conditional_stylesheets()
{
return array(
array(
'condition' => 'IE 6',
'stylesheets' => array(
array(
'href' => 'css/ie6/screen.css',
'media' => 'screen, projector',
),
),
),
);
}
public function javascripts()
{
return array(
array('src' => 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'),
array('src' => 'js/app.js',
);
}
}
<!doctype html>
<html class="no-js" id="{{page_id}}">
<head>
<title>{{title}}</title>
<meta charset="{{charset}}" />
{{#stylesheets}}
<link rel="stylesheet" href="{{href}}" media="{{media}}" />
{{/stylesheets}}
{{#conditional_stylesheets}}
<!--[if {{condition}}]>
{{#stylesheets}}
<link rel="stylesheet" href="{{href}}" media="{{media}}" />
{{/stylesheets}}
<![endif]-->
{{/conditional_stylesheets}}
<script>(function(B,C){B[C]=B[C].replace(/\bno-js\b/,'js');if(!/*@cc_on!@*/0)return;var e = "abbr article aside audio canvas command datalist details figure figcaption footer header hgroup mark meter nav output progress section summary time video".split(' '),i=e.length;while(i--){document.createElement(e[i])}})(document.documentElement,'className');</script>
</head>
<body>
<div id="{{app_id}}">
{{>content}}
</div>
{{#javascripts}}
<script{{#src}} src="{{src}}"{{/src}}>{{content}}</script>
{{/javascripts}}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment