This plug-in is mainly aimed at theme producers, so that theme producers can quickly generate likes, support and tap functions!
Non theme developers please use https://app.zblogcn.com/?id=489 plug-in unit.
After the plug-in is installed and enabled, the theme producer does not need to write php background code, and can insert the specified label in the template file.
10/26: Correct the logic of obtaining IP when using CDN such as accelerator
10/12: Clear the likes of an article when deleting it
8/28: Fix a bug T T
Fix the problem that the script was killed by the Duo Shuo plug-in. Please use the Duo Shuo plug-in friends to upgrade this plug-in to the latest version
1.1 Update: fix the bug when alias is pseudo static
1、 Article page calling method (used in post single. php)
{$sf_praise_sdk. value1} Output the first value
{$sf_praise_sdk. value5} Output the fifth value.
This plug-in supports up to 5 values. When you click to support the function of adding 1, use {$sf_praise_sdk. value1} instead of other functions. Two values can be used to realize the function of pressing.
{$sf_praise_sdk. check} Whether the output has voted 0 has not voted/1 has voted
2、 List Page Call Method
First add {$sf_praise_sdk=SF_praise_sdk:: findPostCount ($article ->ID);}
The output value can then be called like the article page. For example, the number of people standing on the top of the number of people stepping on the list page will be displayed.
3、 Html tag
Add class: sf plan sdk to the tag that needs to vote, and attach sfa='click 'data postid='article id' data value='which number of values' attribute. This tag will automatically capture the click event and submit a vote!
Callback function (optional): add data ok, data check, and data error attributes to the tag. The attribute value is the function name. When calling back, two parameters are brought in, the first is the article ID, and the second is the number of values.
The data ok is called back successfully, the vote has been cast and the data check is called back, and the error is called back to the data error.
Update numerical method: when writing back, it will obtain the html data (integer) in the tag, and then+1 write. Write back the tag as class: sf plan sdk, and attach the attribute of data postid='Article ID 'data value='The number of values' sfa='num'. Remember that only integer can be filled in the label, and no other characters are allowed.
For other instructions on callbacks,
After a successful call, the update value will be executed. Of course, there can be no response tag, and js will not make an error. If there is a data ok callback, it will be called.
If there is no data check callback, the default prompt message will be called. If you want to do nothing, please set an empty method.
All events have effects on the whole website, so the list page can also click to vote. If you don't want to click, remove sfa='click '.
4、 Example
<div class="sf-praise-sdk" sfa='click' data-postid='{$sf_praise_sdk.postid}' data-value="1" data-ok='zijiqugemingzi'> Top (<span class="sf_praise-sdk" sfa='num 'data value='1' data postid='{$sf_praise_sdk. postid}'>{$sf_praise_sdk. value1}</span>) </div> <div class="sf-praise-sdk" sfa='click' data-postid='{$sf_praise_sdk.postid}' data-value="2"> Press<span class="sf_praise-sdk" sfa='num 'data value='2' data postid='{$sf_praise_sdk. postid}'>{$sf_praise_sdk. value2}</span>) </div>
Sample data ok callback function
function zijiqugemingzi(postid,index){ //Your code }