Skip to content

Instantly share code, notes, and snippets.

@robi09
Created February 10, 2016 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robi09/b246622ea2c30ec943e5 to your computer and use it in GitHub Desktop.
Save robi09/b246622ea2c30ec943e5 to your computer and use it in GitHub Desktop.
Get an array with all template parts from one folder
if(!function_exists('revive_home_sections')) {
function revive_home_sections() {
$array = array();
$dir = R_PATH . "/parts/home/order/*";
foreach(glob($dir) as $file) {
if(!is_dir($file)) {
$array[substr(basename($file), 0, strpos(basename($file), "."))] = ucfirst(str_replace('_', ' ', substr(substr(basename($file), 0, strpos(basename($file), ".")), 2)));
}
}
return $array;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment