phpcms v9 升级视频云问题推荐位不能添加

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

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

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

 

方法如下

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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,修改代码如下,将标红的地方删除或注释掉

1
2
3
4
5
6
7
8
<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 @   fsl  阅读(593)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· AI Agent开发,如何调用三方的API Function,是通过提示词来发起调用的吗
点击右上角即可分享
微信分享提示