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'); }

 

 

 

 

 

 

 

 

 

 

 

posted @ 2013-12-13 13:54  fsl  阅读(590)  评论(0编辑  收藏  举报