Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
simple templates loader
<?php
$tplsArr = array();
$filesArr = glob( 'js/app/tpls/*' );
// recursive loop through folder js/app/tpls to load all tpls
function loop($files,$tpls_arr) {
foreach ( $files as $key => $file ) {
if(is_dir($file)) {
$subDirFiles = glob($file."/*");
$tpls_arr = loop($subDirFiles,$tpls_arr);
} else {
preg_match( '/tpls\/(.*)\.handlebars$/', $file, $match );
$fn = $match[1];
if($fn != "") $tpls_arr[$fn] = file_get_contents($file);
}
}
return ($tpls_arr);
}
$tplsArr = loop($filesArr,array());
?>
<script type="text/javascript">
window.Tpls = <? echo json_encode($tplsArr,JSON_HEX_TAG); ?>;
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.