phpcms 增加备案号、联系方式等字段

准备好记事本或者dreamweaver或者其它文本编辑器 打开 phpcms languages zh-cn admin lang php PHPCMS的中文
  1. 准备好记事本或者dreamweaver或者其它文本编辑器

    打开\phpcms\languages\zh-cn\admin.lang.php 

    PHPCMS的中文语言定义文件。

    查找“site_management”大概在505行,在上面新建一行。

    加入新建字段的名称

    $LANG['contacts'] = 'Contacts'; //联系方式

    $LANG['contacts_address'] = 'Address';//地址

    $LANG['contacts_phone'] = 'Phone';//电话

    $LANG['contacts_mobile'] = 'Mobile';//手机

    $LANG['contacts_email'] = 'Email';//邮箱

    $LANG['contacts_qq'] = 'QQ';//QQ

    $LANG['contacts_beian'] = 'Beian';//备案

    同样打开\phpcms\languages\en\admin.lang.php 

    加入英文名称。

  2. 2

    修改后台模板文件

    打开\phpcms\modules\admin\templates\site_add.tpl.php

    搜索“seo_configuration”在“<div class="bk15"></div>”下面新建一行

    复制以下内容

    <div class="bk15"></div>

    <fieldset>

    <legend><?php echo L('contacts')?></legend>

    <table width="100%"  class="table_form">

      <tr>

        <th width="80"><?php echo L('contacts_address')?>:</th>

        <td class="y-bg"><input type="text" class="input-text" name="contacts_address" id="contacts_address" size="30" /></td>

      </tr>

      <tr>

        <th><?php echo L('contacts_phone')?>:</th>

        <td class="y-bg"><input type="text" class="input-text" name="contacts_phone" id="contacts_phone" size="30" /></td>

      </tr>

        <tr>

        <th><?php echo L('contacts_mobile')?>:</th>

        <td class="y-bg"><input type="text" class="input-text" name="contacts_mobile" id="contacts_mobile" size="30" /></td>

      </tr>

    <tr>

        <th><?php echo L('contacts_email')?>:</th>

        <td class="y-bg"><input type="text" class="input-text" name="contacts_email" id="contacts_email" size="30" /></td>

      </tr>

    <tr>

        <th><?php echo L('contacts_qq')?>:</th>

        <td class="y-bg"><input type="text" class="input-text" name="contacts_qq" id="contacts_qq" size="30" /></td>

      </tr>

    <tr>

        <th><?php echo L('contacts_beian')?>:</th>

        <td class="y-bg"><input type="text" class="input-text" name="contacts_beian" id="contacts_beian" size="30" /></td>

      </tr>

    </table>

    </fieldset>

  3. 3

    同样打开 站点信息修改页面\phpcms\modules\admin\templates\site_edit.tpl.php

    加入上一步添加的字段。

  4. 4

    打开后台站点信息修改文件

    \phpcms\modules\admin\site.php

     

    查找“add()”

    查找“$default_style”

    在下面新建一行,加入字段获取代码:

    $contacts_address = isset($_POST['contacts_address']) && trim($_POST['contacts_address']) ? trim($_POST['contacts_address']) : '';

    $contacts_phone = isset($_POST['contacts_phone']) && trim($_POST['contacts_phone']) ? trim($_POST['contacts_phone']) : '';

    $contacts_mobile = isset($_POST['contacts_mobile']) && trim($_POST['contacts_mobile']) ? trim($_POST['contacts_mobile']) : '';

    $contacts_email = isset($_POST['contacts_email']) && trim($_POST['contacts_email']) ? trim($_POST['contacts_email']) : '';

    $contacts_qq = isset($_POST['contacts_qq']) && trim($_POST['contacts_qq']) ? trim($_POST['contacts_qq']) : '';

    $contacts_beian = isset($_POST['contacts_beian']) && trim($_POST['contacts_beian']) ? trim($_POST['contacts_beian']) : '';

     

    查找“=>$default_style”在后面加入',contacts_address'=>$contacts_address,'contacts_phone'=>$contacts_phone,'contacts_mobile'=>$contacts_mobile,'contacts_email'=>$contacts_email,'contacts_qq'=>$contacts_qq,'contacts_beian'=>$contacts_beian)

     

    同样的在"edit()”函数里面

    加入更新字段的代码

  5. 5

    然后在修改数据库

    打开数据表

    v9_site

    在数据表结构新建以下字段

    contacts_address varchar(100)

    contacts_phone varchar(30)

    contacts_mobile varchar(30)

    contacts_email varchar(30)

    contacts_qq varchar(30)

    contacts_qq varchar(30)

    contacts_beian varchar(30)

    然后保存

    phpcms 站点管理 自定义变量 增加备案等字段
  6. 6

    打开文件:phpcms\libs\functions\global.func.php,

    找到大概1442行,$seo['site_title'] =isset($site['site_title']) && !empty($site['site_title']) ? $site['site_title'] : $site['name'];

    在这行下面添加:$seo['contacts_address'] = $site['contacts_address'];

    前台模板页面用标签: {$SEO['contacts_address']}

您可能有感兴趣的文章
如何使用PHPCMS V9轻松完成WAP手机网站搭建全好代码教程

如何使用PHPCMS搭建wap手机网站

phpstudy+phpcms建站

用PHPCMS V9完成wap网站四步法

用phpcms切换中英文网页的方法(不用解析二级域名)、phpcms完成pc和手机端切换(同一域名)