文件路径:/caches/configs/system.phpphp
在第30行左右,css
1api |
|
在此行下添加配置,我这里是一个qq咨询的地址,结果以下:app
1函数 2网站 |
|
文件路径:/phpcms/base.phpspa
在第51行左右,
1 |
|
在此行下添加配置以下:
1 2 3 4 |
|
到这一步以后,就已经能够在模板中调用了,调用方法{CHAT_PATH},模板自动解析。
为了方便之后修改修护,不用每次都去改代码,咱们去修改一下后台模板来实现。
文件路径:/phpcms/modules/admin/templates/setting.tpl.php
在第73行左右,
<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="50" value="<?php echo $upload_url?>" /></td>
</tr>
在此行下添加配置以下:
<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="50" value="<?php echo $upload_url?>" /></td>
</tr>
<tr>
<th width="120"><?php echo L('setting_chat_path')?></th>
<td class="y-bg"><input type="text" class="input-text" name="setconfig[chat_path]" id="chat_path" size="50" value="<?php echo $chat_path?>" /></td>
</tr>
文件路径:/phpcms/languages/zh-cn/admin.lang.php
在第170行左右,
1 |
|
在此行下添加配置以下:
1 2 |
|
文件路径:/phpcms/languages/zh-cn/admin.lang.php
在第42行左右,在’img_path’后面添加’chat_path’,这样才能保存设置
if(in_array($k,array('js_path','css_path','img_path','attachment_stat','admin_log','gzip','errorlog','phpsso','phpsso_appid','phpsso_api_url','phpsso_auth_key','phpsso_version','connect_enable', 'upload_url','sina_akey', 'sina_skey', 'snda_enable', 'snda_status', 'snda_akey', 'snda_skey', 'qq_akey', 'qq_skey','qq_appid','qq_appkey','qq_callback','admin_url'))) {
修改后结果以下:
if(in_array($k,array('js_path','css_path','img_path','chat_path','attachment_stat','admin_log','gzip','errorlog','phpsso','phpsso_appid','phpsso_api_url','phpsso_auth_key','phpsso_version','connect_enable', 'upload_url','sina_akey', 'sina_skey', 'snda_enable', 'snda_status', 'snda_akey', 'snda_skey', 'qq_akey', 'qq_skey','qq_appid','qq_appkey','qq_callback','admin_url'))) {
PHPCMS V9中添加自定义全局变量就是这么添加的,它的优势是方便维护,缺点是要修改几个文件,在更新PHPCMS V9时可能会被替换,若是被替换就须要从新来一遍。