-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconfig.php
More file actions
44 lines (27 loc) · 1.37 KB
/
config.php
File metadata and controls
44 lines (27 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
error_reporting( E_ALL );
define( 'FILE_ROOT', dirname( __FILE__ ) );
define( 'PROJECT_ROOT', dirname( $_SERVER[ 'PHP_SELF' ] ) );
define( 'URL_ROOT', dirname( dirname( PROJECT_ROOT ) ) );
$content = file_get_contents( FILE_ROOT . '/data.json' );
$content = preg_replace( '/\/\*[\s\S]*?\*\//', '', $content );
$datas = json_decode( $content, true );
//print_r( $datas );
/* 模板配置 */
date_default_timezone_set('Asia/Shanghai');
include_once("smarty_lib/Smarty.class.php"); //导入模板文件
$smarty = new Smarty();//创建smarty对象
$smarty->config_dir = "smarty_lib/Config_File.class.php"; //目录变量
$smarty->caching = false; //是否使用缓存
$smarty->template_dir = FILE_ROOT . "/tpl"; //设置模板目录
$smarty->compile_dir = FILE_ROOT . "/smarty/templates_c";//设置编译目录
$smarty->cache_dir = FILE_ROOT . "/smarty/smarty_cache";//缓存文件
$smarty->left_delimiter = "{{";
$smarty->right_delimiter="}}";
$smarty->assign( 'PROJECT_ROOT', PROJECT_ROOT );
$smarty->assign( 'URL_ROOT', URL_ROOT);
$smarty->assign( 'datas', $datas );
$smarty->assign( 'compsList', $datas['compsList'] );
$smarty->assign( 'extraMenu', $datas['extraMenu'] );
$smarty->assign( 'websiteLink', $datas['websiteLink'] );
?>