前端模板增加主题管理

This commit is contained in:
2016-11-25 13:55:03 +08:00
parent 06906a5b22
commit 2bb2af2c0c
46 changed files with 265 additions and 106 deletions

View File

@@ -71,4 +71,28 @@ class Config extends Base{
}
return $value;
}
public function getThemesList(){
$files = array();
$files['pc'] = $this->getList('pc');
$files['mobile'] = $this->getList('mobile');
return $files;
}
protected function getList($type){
$path = ROOT_PATH . 'template/' . $type . '/';
$file = opendir($path);
while (false !== ($filename = readdir($file))) {
if (!in_array($filename, array('.', '..'))) {
$files = $path . $filename . '/info.php';
if (is_file($files)) {
$info = include($files);
$info['id'] = $filename;
$info['img'] = '/template/' . $type . '/' . $filename . '/' . $info['img'];
$list[] = $info;
}
}
}
return isset($list) ? $list : array();
}
}