Skip to content

Instantly share code, notes, and snippets.

@remydagostino
Created September 12, 2013 00:26
Show Gist options
  • Save remydagostino/6531717 to your computer and use it in GitHub Desktop.
Save remydagostino/6531717 to your computer and use it in GitHub Desktop.
Create Include all files within a directory
<?php
function IncludeKoTemplates($path) {
$files = scandir(dirname(__FILE__).$path);
foreach($files as $file_name){
if( in_array($file_name,array(".","..")) ) continue;
$template_id = basename($file_name, ".html");
$contents = file_get_contents(dirname(__FILE__). $path . $file_name);
echo "<script type=\"text/html\" id=\"{$template_id}\">{$contents}</script>";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment