文件路徑:/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時可能會被替換,若是被替換就須要從新來一遍。