Created
September 12, 2013 00:26
-
-
Save remydagostino/6531717 to your computer and use it in GitHub Desktop.
Create Include all files within a directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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