欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php自動獲取目錄下的模板的代碼

 更新時間:2010年08月08日 17:14:43   作者:  
php自定義函數(shù)之自動獲取目錄下的模板的實現(xiàn)代碼,一般制作模板分離的管理系統(tǒng)需要用得到。
目錄下必須有default.gif(此圖為模板縮略圖)的才為合法的模板
復(fù)制代碼 代碼如下:

function get_template ()
{
$template = array ();
$dir = CMS_ROOT.'/tpl/';
$n = 0;
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file =='.' or $file == '..' or $file == '.svn')
{
continue;
}
if (is_dir ($dir.$file))
{
if (file_exists ($dir.$file.'/default.gif'))
{
$template[$n]['dir'] = $file;
$template[$n]['pic'] ='/tpl/'.$file.'/default.gif';
}
}
$n++;
}
closedir($dh);
}
}
return $template;
}

相關(guān)文章

最新評論