votingapi模块是一个提供投票系统的API,要配合其他模块进行使用,单独使用没有效果,前几天想做一个推荐票的功能,看了一下这个模块.
这个模块启用之后,主要提供这几个函数.
votingapi_set_votes(&$votes, $criteria = NULL) //设置投票
votingapi_delete_votes($votes = array())//删除投票
votingapi_select_results($criteria = array(), $limit = 0)//得到结果
votingapi_delete_results($vote_results = array())//删除结果
votingapi_select_votes($criteria = array(), $limit = 0)//得到独立的投票结果
$vote是一个数组变量,可以设置下列内容,其中对于votingapi_set_votes函数来说,当数据库中已经存在记录时,会覆盖,而不会增加新记录,要新加的话,一定要将传入的参数设置为不一样.
* @param $votes
* An array of votes, each with the following structure:
* $vote['content_type'] (Optional, defaults to 'node')
* $vote['content_id'] (Required)
* $vote['value_type'] (Optional, defaults to 'percent')
* $vote['value'] (Required)
* $vote['tag'] (Optional, defaults to 'vote')
* $vote['uid'] (Optional, defaults to current user)
* $vote['vote_source'] (Optional, defaults to current IP)
* $vote['timestamp'] (Optional, defaults to time())
这个模块主要提供API供其他模块调用,当开启多个投票模块时,可能会有问题,
最新评论