<?
$page = "admin_templates";
include "admin_header.php";


// GET ARRAYS OF TEMPLATES FROM TEMPLATE DIRECTORY
$user_files = Array();
$base_files = Array();
if($handle = opendir('../templates')) { 
  $c1 = 0;
  $c2 = 0;
  while (false !== ($file = readdir($handle))) { 
    if($file != "." AND $file != ".." AND strstr($file, "admin_") === false) {
      // IF FILES ARE USER PAGES
      if(strstr($file, "user_") AND $file != "user_header.tpl" AND $file != "user_footer.tpl") {
        $user_files[$c1] = Array('filename' => $file); $c1++;
      // IF FILES ARE BASE PAGES
      } elseif($file != "header.tpl" AND $file != "footer.tpl" AND $file != "styles.css") {
        $base_files[$c2] = Array('filename' => $file); $c2++;
      }
    }
  }
  closedir($handle); 
} 


// ASSIGN VARIABLES AND SHOW TEMPLATES PAGE
$smarty->assign('user_files', $user_files);
$smarty->assign('base_files', $base_files);
$smarty->display("$page.tpl");
exit();
?>