Skip to content

Instantly share code, notes, and snippets.

@tylersticka
Created March 7, 2012 17:34
Show Gist options
  • Save tylersticka/1994574 to your computer and use it in GitHub Desktop.
Save tylersticka/1994574 to your computer and use it in GitHub Desktop.
Extends Mustache's partial method to fetch from a known file path.
<?php
class Example extends Mustache {
protected function _getPartial($tag_name) {
$template_path = "./templates/partials/$tag_name.mustache";
if (file_exists($template_path)) {
$this->_partials[$tag_name] = file_get_contents($template_path);
}
return parent::_getPartial($tag_name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment