phpcms添加网站联系方式,联系地址等配置方法

 时间:2024-10-24 19:11:45

1、第一步:找到文件phpcms\modules\admin\functions\global.func.php,找到下列函数:function set_config($config, $filename=”system”) {$configfile = CACHE_PATH.’configs’.DIRECTORY_SEPARATOR.$filename.’.php’;if(!is_writable($configfile)) showmessage(‘Please chmod ‘.$configfile.’ to 0777 !’);$pattern = $replacement = array();foreach($config as $k=>$v) {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’))) {$v = trim($v);$configs[$k] = $v;$pattern[$k] = “/'”.$k.”‘\s*=>\s*([‘]?)[^’]*([‘]?)(\s*),/is”;$replacement[$k] = “‘”.$k.”‘ => \${1}”.$v.”\${2}\${3},”;}}$str = file_get_contents($configfile);$str = preg_replace($pattern, $replacement, $str);return pc_base::load_config(‘system’,’lock_ex’) ? file_put_contents($configfile, $str, LOCK_EX) : file_put_contents($configfile, $str);}

2、修改为:function set_config($config, $filename=”system”) {$configfile = CACHE_PATH.’configs’.DIRECTORY_SEPARATOR.$filename.’.php’;if(!is_writable($configfile)) showmessage(‘Please chmod ‘.$configfile.’ to 0777 !’);$pattern = $replacement = array();foreach($config as $k=>$v) {if(in_array($k,array(‘web_mobile’,’web_address’,’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’))) {$v = trim($v);$configs[$k] = $v;$pattern[$k] = “/'”.$k.”‘\s*=>\s*([‘]?)[^’]*([‘]?)(\s*),/is”;$replacement[$k] = “‘”.$k.”‘ => \${1}”.$v.”\${2}\${3},”;}}$str = file_get_contents($configfile);$str = preg_replace($pattern, $replacement, $str);return pc_base::load_config(‘system’,’lock_ex’) ? file_put_contents($configfile, $str, LOCK_EX) : file_put_contents($configfile, $str);}

3、找到文件phpcms\base.php,找到以下内容:define(‘WEB_PATH’,pc_base::load_config(‘system’,’web_path’));//js 路径define(‘JS_PATH’,pc_base::load_config(‘system’,’js_path’));//css 路径define(‘CSS_PATH’,pc_base::load_config(‘system’,’css_path’));//img 路径define(‘IMG_PATH’,pc_base::load_config(‘system’,’img_path’));//动态程序路径define(‘APP_PATH’,pc_base::load_config(‘system’,’app_path’));在后面添加:define(‘WEB_MOBILE’,pc_base::load_config(‘system’,’web_mobile’));define(‘WEB_ADDRESS’,pc_base::load_config(‘system’,’web_address’));

4、找到文件:\phpcms\modules\admin\templates\setting.tpl.php,找到以下内容:<tr><th width=”120″><?php echo L(‘setting_admin_email’)?></th><td class=”y-bg”><input type=”text” class=”input-text” name=”setting[admin_email]” id=”admin_email” size=”30″ value=”<?php echo $admin_email?>”/></td></tr>在后面添加:<tr><th width=”120″><?php echo L(‘setting_web_mobile’)?></th><td class=”y-bg”><input type=”text” class=”input-text” name=”setconfig[web_mobile]” id=”web_mobile” size=”30″ value=”<?php echo WEB_MOBILE?>”/></td></tr><tr><th width=”120″><?php echo L(‘setting_web_address’)?></th><td class=”y-bg”><input type=”text” class=”input-text” name=”setconfig[web_address]” id=”web_address” size=”30″ value=”<?php echo WEB_ADDRESS?>”/></td></tr>

5、找到文件:\phpcms\languages\zh-cn\admin.lang.php,添加以下内容:$LANG[‘setting_web_mobile’] = ‘联系电话’;$LANG[‘setting_web_address’] = ‘联系地址’;这样在后台点击“设置”->“基本设置”,就可以修改这两项基本设置了。

6、在前台任意模板调用:{WEB_MOBILE},{WEB_ADDRESS},就可以显示后台设置的手机号码和联系地址了,同理还可以添加其它的配置项。

  • 樱花大战3超级完美全流程攻略
  • 阿里云怎么购买海外虚拟主机
  • 冒险岛黑森林打开隐藏的黄金宝箱攻略
  • 易语言系列教程:[1]设置易语言及第一个程序
  • 神荒魔域1.0正式版怎么获取装备 怎样升级
  • 热门搜索
    教师节送老师什么比较好呢 大街小巷的意思 不足为训的意思 什么护肤品适合20岁 渎职是什么意思 祝福卡 悠闲的意思是什么 去澳大利亚买什么好 镜像文件是什么意思 生日祝福信息