Regarding the modification of phpcms v9 voting module option sorting problem_PHP tutorial

WBOY
Release: 2016-07-14 10:10:04
Original
968 people have browsed it

Regarding the modification of the phpcms v9 voting module option sorting listorder setting issue, I mainly modified three files and three places.

I think this method is enough for me, and everyone is welcome to try it out.

Mainly modify three files:

1.phpcmsmodulesvotetemplatesvote_edit.tpl.php found in

[html]

Add a piece of code at the end, a form text box about sorting


[html]
Sorting:

Sort:Save.

Found in 2.phpcmsmodulesvotevote.php


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

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

below


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

$this->db2->set_listorder($_POST['piaoshu']);Save. There is no filtering in this operation, friends can consider it.

Found in 3.phpcmsmodelvote_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();
}

was changed to

[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();
}
In fact, the PC itself has a function for this operation, but it seems not to be enabled.

After making the changes, update the cache, go to the backend->vote, select your vote, and try modifying the options.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477594.htmlTechArticle Regarding the modification of the phpcms v9 voting module option sorting listorder setting issue, I mainly modified three files and three places. I think this method is enough for me, and everyone is welcome to try it out. ...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!