PHPCMS V9 自定义添加 全局变量{SKIN_PATH}方法:实现自定义模板分离

前言:目前v9版本新增{js_path},{css_path},{img_path}三个全局变量,代替2008版本中{skin_path},样式图片脚本分开路径,确实达到了一定在后台管理方便的目的,但是个人感觉并不十分便捷

优势:可实现自定义模板分离,与default模板images/js/css文件分开存放,方便管理,并实现自定义模板与后台样式分离

实现方法如下:


语言项修改文件,根目录/phpcms/languages/zh-cn/admin.lang.php
在文件167行
        $lang['setting_img_path'] = '图片路径';
之下添加
        $lang['setting_skin_path'] = '自定义皮肤路径';

语句,增加对应自定义模板路径语言项

修改配置文件,根目录/phpcms/modules/admin/functions/global.func.php
在文件42行
        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','admin_url')))................
找到'img_path',在之后添加'skin_path',注意格式

修改后台显示模板文件,根目录/phpcms/modules/admin/functions/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')?>"});
之下添加
        $("#skin_path").formvalidator({onshow:"<?php echo l('setting_input').l('setting_skin_path')?>",onfocus:"<?php echo l('setting_skin_path').l('setting_end_with_x')?>"}).inputvalidator({onerror:"<?php echo l('setting_skin_path').l('setting_input_error')?>"}).regexvalidator({regexp:"(.+)\/$",onerror:"<?php echo l('setting_skin_path').l('setting_end_with_x')?>"});

在文件67-70行
        <tr>
    <th width="120"><?php echo l('setting_img_path')?></th>
    <td class="y-bg"><input type="text" class="input-text" name="setconfig[img_path]" id="img_path" size="50" value="<?php echo img_path?>" /></td>
  </tr>
之下添加
  <tr>
    <th width="120"><?php echo l('setting_skin_path')?></th>
    <td class="y-bg"><input type="text" class="input-text" name="setconfig[skin_path]" id="skin_path" size="50" value="<?php echo skin_path?>" /></td>
  </tr>

配置文件缓存修改,根目录/caches/configs/system.php
在文件57行
        'img_path' => 'http://www.iuuva.cn/statics/images/', //cdn img
之下添加
        'skin_path' => 'http://www.iuuva.cn/skin/', //自定义皮肤路径


至此自定义添加全局变量{skin_path}完毕,可后台更改自定义模板相关文件路径

文章来源:https://www.kuaijiandian.com

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值