zoukankan      html  css  js  c++  java
  • phpcms v9 升级视频云问题推荐位不能添加

    因为使用的是v9的早期版本,后来升级的时候没敢升级数据库,直接使用了老的数据库结构,造成【推荐位】添加不能使用,报告没有thumb列。

    查看数据库果然没有,没办法要么添加相关的列,要么禁用上传缩略图。

    最后决定修改代码,而不是修改数据库结构。

    方法如下

    1,进入目录/phpcms/modules/admin找到position.php文件,修改添加方法如下

    public function add() {
    		if(isset($_POST['dosubmit'])) {
    			if(!is_array($_POST['info']) || empty($_POST['info']['name'])){
    				showmessage(L('operation_failure'));
    			}
    			$_POST['info']['siteid'] = intval($_POST['info']['modelid']) ? get_siteid() : 0;
    			$_POST['info']['listorder'] = intval($_POST['info']['listorder']);
    			$_POST['info']['maxnum'] = intval($_POST['info']['maxnum']);
    			//$_POST['info']['thumb'] = $_POST['info']['thumb']; //这行注释掉
    			$insert_id = $this->db->insert($_POST['info'],true);
    			$this->_set_cache();
    			if($insert_id){
    				showmessage(L('operation_success'), '', '', 'add');
    			}
    		} 
    

      

    2,修改页面模板,进入目录/phpcms/modules/admin/templates  找到position_add.tpl.php,修改代码如下,将标红的地方删除或注释掉

    <tr>
    <td><?php echo L('extention_name')?></td> 
    <td><input type="text" name="info[extention]" id="extention" class="input-text" size="20" value=""></input></td>
    </tr>
    <tr>
    <td><?php echo L('上传对应图')?></td> 
    <td><?php echo form::images('info[thumb]', 'thumb', '', 'thumb','','30')?></td>
    </tr> 
    

      

    然后一切就正常了.

    当然如果要修改同样正常使用按同样方法修改/phpcms/modules/admin/templates  找到position_edit.tpl.php

    public function edit() {
            if(isset($_POST['dosubmit'])) {
                $_POST['posid'] = intval($_POST['posid']);
                if(!is_array($_POST['info']) || empty($_POST['info']['name'])){
                    showmessage(L('operation_failure'));
                }
                $_POST['info']['siteid'] = intval($_POST['info']['modelid']) ? get_siteid() : 0;
                $_POST['info']['listorder'] = intval($_POST['info']['listorder']);
                $_POST['info']['maxnum'] = intval($_POST['info']['maxnum']);            
                //$_POST['info']['thumb'] = $_POST['info']['thumb']; //这行注释掉
    $this->db->update($_POST['info'],array('posid'=>$_POST['posid'])); $this->_set_cache(); showmessage(L('operation_success'), '', '', 'edit'); }
  • 相关阅读:
    不安装oracle客户端,用plsql连接oracle
    NaviCat Primium远程连接Oracle 11g数据库操作方法
    PLSQL DEVELOPER 使用技巧
    MyEclipse/Eclipse中properties文件中文乱码问题解决
    log4j日志的配置--Debug
    java-jpa-criteriaBuilder使用入门
    使用@CrossOrigin实现跨域请求
    Could not autowire field: private javax.servlet.http.HttpServletRequest
    java高级-泛型<T>和注解封装与使用
    TableView自动上移
  • 原文地址:https://www.cnblogs.com/fslnet/p/3472945.html
Copyright © 2011-2022 走看看