Modify the option Sorting Problem of the phpcms v9 voting Module

Source: Internet
Author: User

About how to set listorder in the option sorting of the phpcms v9 voting module, the younger brother changed three files in three places.

I think this method is enough. You are welcome to make a brick.

Modify three files:

1. Found in phpcms \ modules \ vote \ templates \ vote_edit.tpl.php

[Html]
<Input type = "text" name = "option [<? Php echo $ option ['optionid']?>] "Size =" 40 "require =" true "value =" <? Php echo $ option ['option'];?> "/>

<Input type = "text" name = "option [<? Php echo $ option ['optionid']?>] "Size =" 40 "require =" true "value =" <? Php echo $ option ['option'];?> "/> Add a piece of code to the end of the text box for sorting forms


[Html]
Sort: <input type = "text" value = "<? Php echo $ option ['storder'];?> "Name =" piaoshu [<? Php echo $ option ['optionid']?>] ">

Sort: <input type = "text" value = "<? Php echo $ option ['storder'];?> "Name =" piaoshu [<? Php echo $ option ['optionid']?>] "> Save.

2. Found in phpcms \ modules \ vote. php


[Html]
$ This-> db2-> update_options ($ _ POST ['option']);

$ This-> db2-> update_options ($ _ POST ['option']); add


[Html]
$ This-> db2-> set_listorder ($ _ POST ['piaoshu']);

$ This-> db2-> set_listorder ($ _ POST ['piaoshu']); save. This operation is not filtered. You can consider it.

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

 

Modify


[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 the function for this operation, but it does not seem to have been enabled.

After the change, update the cache. Go to the backend and select your vote in the voting area. Modify the options and try again.


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.