Home > Article > Backend Development > Regarding the modification of phpcms v9 voting module option sorting problem_PHP tutorial
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();
}
{
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.