在caches/configs/system.php里写上要定义的变量,比如:
‘qq’ => ‘6045564’,
然后phpcms/base.php里定义qq变量
找到//定义网站根路径
在下面写上:
define('QQ',pc_base::load_config('system','qq'));
至此,变量的定义就完成了,就可以使用{QQ}来调用
下面的修改是完善后台管理的:
打开:phpcms\modules\admin\functions\global.func.php
找到:
设置config文件里的
if(in_array($k,array('js_path','css_path','img_path','attachment_stat'
这一段
在里面加上’,’qq
变成
if(in_array($k,array('js_path','qq','css_path','img_path','attachment_stat
然后到
phpcms\modules\admin\templates\setting.tpl.php
里写上表单:
12行找到
$("#img_path").formValidator({onshow:"<?php echo L('setting_input').L('setting_img_path')?>",onfocus:"<?php echo L('setting_img_path').L('setting_end_with_x')?>"}).inputValidator({onerror:"<?php echo L('setting_img_path').L('setting_input_error')?>"}).regexValidator({regexp:"(.+)\/$",onerror:"<?php echo L('setting_img_path').L('setting_end_with_x')?>"});
下面另起一行写入
$("#qq").formValidator({onshow:"<?php echo L('setting_input').L('setting_qq')?",onfocus:"<?php echo L('setting_qq').L('请输入数字')?>"}).inputValidator({onerror:"<?php echo L('setting_qq').L('setting_input_error')?>"}).regexValidator({regexp:"(.+)\$",onerror:"<?php echo L('setting_qq').L('请输入数字')
72行找到:
<tr> <th width="120"><?php echo L('setting_upload_url')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[upload_url]" id="upload_url" size="70" value="<?php echo $upload_url?>" /></td> </tr>
在下面另起写入:
<tr> <th width="120"><?php echo L('setting_qq')?></th> <td class="y-bg"><input type="text" class="input-text" name="setconfig[qq]" id="qq" size="70" value="<?php echo $qq?>" /></td> </tr>
然后这样就可以了,但是缺少个语言项,到这里加
phpcms\languages\zh-cn最下面的?>上面加上
$LANG['setting_qq'] = 'QQ';
至此,后台管理也写好 ,就可以到后台-设置-基本设置里,看到你加的表单,就可以管理了