Heim  >  Artikel  >  Backend-Entwicklung  >  关于phpcms v9投票模块选项排序问题修改_PHP教程

关于phpcms v9投票模块选项排序问题修改_PHP教程

WBOY
WBOYOriginal
2016-07-14 10:10:04974Durchsuche

关于phpcms v9投票模块选项排序listorder设定问题修改,小弟主要修改了三个文件三处地方。

此方法我觉得自己已经够用,欢迎大家来拍砖。

主要修改三个文件:

1.phpcms\modules\vote\templates\vote_edit.tpl.php中找到

[html]
 

在后面添加一段代码,有关排序的表单文本框


[html]
排序: 

排序:保存。

2.phpcms\modules\vote\vote.php中找到


[html]
$this->db2->update_options($_POST['option']); 

$this->db2->update_options($_POST['option']);在下面加上


[html]
$this->db2->set_listorder($_POST['piaoshu']); 

$this->db2->set_listorder($_POST['piaoshu']);保存。本次操作没有过滤,朋友们可以考虑一下。

3.phpcms\model\vote_option_model.class.php中找到


[html]
function set_listorder($data) 
    { 
        if(!is_array($data)) return FALSE; 
        foreach($data as $key=>$val) 
        { 
            $val = intval($val); 
            $key = intval($key); 
            $this->db->query("update $tbname set listorder='$val' where {$keyid}='$key'"); 
        } 
        return $this->db->affected_rows(); 
    } 

function set_listorder($data)
 {
  if(!is_array($data)) return FALSE;
  foreach($data as $key=>$val)
  {
   $val = intval($val);
   $key = intval($key);
   $this->db->query("update $tbname set listorder='$val' where {$keyid}='$key'");
  }
  return $this->db->affected_rows();
 }

 

修改成


[html]
function set_listorder($data) 
    { 
        if(!is_array($data)) return FALSE; 
        foreach($data as $key=>$val) 
        { 
            $val = intval($val); 
            $key = intval($key); 
            $this->db->query("update zzhds_vote_option set listorder='$val' where optionid='$key'"); 
        } 
        return $this->db->affected_rows(); 
    } 

function set_listorder($data)
 {
  if(!is_array($data)) return FALSE;
  foreach($data as $key=>$val)
  {
   $val = intval($val);
   $key = intval($key);
   $this->db->query("update zzhds_vote_option set listorder='$val' where optionid='$key'");
  }
  return $this->db->affected_rows();
 }
其实pc本身有这个操作的函数,不过好像没启用。

改完之后更新一下缓存,进后台->投票中选择您的投票,修改选项试下吧。


 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477594.htmlTechArticle关于phpcms v9投票模块选项排序listorder设定问题修改,小弟主要修改了三个文件三处地方。 此方法我觉得自己已经够用,欢迎大家来拍砖。...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn