cbe_helpful

08/07/2011 - plugin, textpattern

Ce plugin a deux fonctions : noter pour un article en votant positivement ou négativement, et retourner une liste des articles les mieux (ou moins bien) notés.

C’est une reprise de wlk_helpful, et à ce titre il est capable, à sa première activation, d’en récupérer les données.

Il offre de plus

  • une interface administrateur accessible depuis le panneau des plugins ou dans l’onglet extensions
  • un meilleur contrôle de l’affichage
  • la possibilité de définir un laps de temps minimum entre deux votes pour une même adresse IP

Ce que vous en pensez [2]

Aide du plugin

Visitors can rate articles (based on wlk_helpful)

cbe_helpful

Table of contents

Credits

  • Walker Hamilton, for wlk_helpful on which this plugin is based
  • Jukka Svahn, for rah_external_output (v1.0 minimum) on which the plugin heavily relies on
  • Pat64, who took time to test, feedback, test, feedback, test ... feedback ... and so on

Prerequisites

This plugin requires

Features

  • just install and activate, no need to worry about additional scripts
  • automatically retrieves data from wlk_helpful if installed and active
  • set time threshold between two votes having the same IP
  • define your own presentation

Download and support

Download from the plugin page.

Visit the forum thread for support.

Installation and setup

rah_external_output v1.0 minimum must be installed and active otherwise cbe_helpful won't be activated and you will receive a message stating that you have to install/activate rah_external_output.

Copy/paste in the Admin > Plugins tab to install.

Setup is automatic at activation.

Admin side usage

Options are available from the plugins pane, or go to Extensions > Article Ratings.

Client side usage

The jQuery library must be loaded, anywhere in the page.

Vote widget: <txp:cbe_helpful />

Just put it in an individual article where you want it to appear. Can be used either as a single tag or as a pair.

Attribute Description and values Example
label Label to prepend to the output.
Default : as defined in admin side
label="Rate it !"
labeltag Tag wrapping the label without brackets.
Default: h2
labeltag="h3"
labelclass (X)HTML class attribute to apply to labeltag.
Default: unset
labelclass="widget-title"
wraptag Tag wrapping the widget without brackets. Effective only if used with the form attribute or as a pair.
Default: div
wraptag="ul"
class (X)HTML class attribute to apply to wraptag
Default: unset
class="widget"
showonly Whether to authorize voting or not. Use it, for example, to just display counts in an article list context.
Values: 0, 1
Default: 0
showonly="1"
form Form used to display the widget.
Default: unset
form="ballot"

Used as a single tag, outputs the minimal markup needed as an unordered list.

Used as a pair or with the form attribute, lets you customize the way it is displayed with the following tags :

<txp:cbe_helpful_label />

Displays the widget label as defined in admin side. Can also be used as a standalone tag (i.e. outside <txp:cbe_helpful>).

Attribute Description and values Example
wraptag Tag wrapping the widget without brackets.
Default: unset
wraptag="h2"
class Class for the label.
Default: unset
class="widget"

<txp:cbe_helpful_score />

Displays the score formatted as specified in admin side : absolute value, ratio or percentage of positive votes

Can be used as a standalone tag or enclosed in cbe_helpful or cbe_helpful_list.

Attribute Description and values Example
wraptag Tag wrapping the score without brackets, can not be blank.
Default: span
wraptag="p"
class Class for styling.
Default: unset
class="score"

<txp:cbe_helpful_yes />, <txp:cbe_helpful_no />, <txp:cbe_helpful_total_votes />

Displays number of positive [resp. negative, total] votes, for <txp:cbe_helpful_yes /> and <txp:cbe_helpful_no /> only a link to click if the vote if possible.

Must be enclosed in cbe_helpful or cbe_helpful_list.

In a list based on time (see <txp:cbe_helpful_list />), the displayed values are for the considered period only.

Attribute Description and values Example
wraptag Tag wrapping the number without brackets, can not be blank.
Default: span
wraptag="p"
class Class used to style the number.
Default: unset
class="voices"
voteclass Class used to style the link.
Default: unset
class="vote"
showonly txp:cbe_helpful_yes and txp:cbe_helpful_no only !
Like in txp:cbe_helpful: whether to authorize voting or not. Use it, for example, to just display counts in an article list context.
Default: 0
See below
labelshowonly txp:cbe_helpful_yes and txp:cbe_helpful_no only.
If set AND no voting authorized (showonly="1"): label to display instead of the one defined in preferences.
txp:cbe_helpful_total_votes only.
If set: label to display instead of the one defined in preferences.
Default: unset
<txp:cbe_helpful_yes showonly="1" labelshowonly="people found this helpfulful" />

Tops and flops: <txp:cbe_helpful_list />

Can be used either as a single tag or as a pair.

Displays an ordered list of article titles selected and sorted as follows (default is the titles of the 5 best rated articles):

Attribute Description and values Example
label Label to prepend to the output.
Default : unset
label="Ratings"
labeltag Tag wrapping the label without brackets.
Default: h2
labeltag="h3"
labelclass (X)HTML class attribute to apply to labeltag.
Default: unset
labelclass="summary-title"
wraptag HTML tag wrapping the resulting list.
Default: ol
wraptag="p"
break HTML tag separating elements of the output.
Default: li
break="br"
class Class for the list.
Default: cbe_helpful_list
class="parade"
breakclass Class for the HTML break tag.
Default: unset
breakclass="element"
form Form used to display some article details (standard article tags, or cbe_helpful tags).
Default: unset
form="prize_list"
limit Number of items to display.
Default: 5
limit="10"
which Whether to display the best ratings (top) or the worst (anything else).
Default: top
which="flop"
order How to sort the list, ascending or descending order.
Default: asc
order="desc"
period Liste articles that have been rated in a given time interval.
Possible values: today (or this day), yesterday (or last day), this week, last week, this month, last month, this year, last year
Default: unset (all time)
period="this month"

Examples

Simple widget

<txp:cbe_helpful />

More elaborate widget

<txp:cbe_helpful labeltag="h2">
  <p><txp:cbe_helpful_score /> people found this article useful. Do you ?</p>
  <p>
  <txp:cbe_helpful_yes class="green" />
  <txp:cbe_helpful_no class="red" />
  </p>
</txp:cbe_helpful>

Detailed Top 10

<txp:cbe_helpful_list label="Top 10" labeltag="h2" limit="10">
  <txp:permlink><txp:title /></txp:permlink>
  <txp:excerpt />
</txp:cbe_helpful_list>

or

<txp:cbe_helpful_list limit="10" form="topten" />

with the accurate "topten" form.

Flop5 beginning with the worst

<txp:cbe_helpful_list which="flop" order="asc" />

Display only count in article list context

In your article form:

<txp:if_article_list>
  <txp:cbe_helpful showonly="1">
    <txp:cbe_helpful_yes labelshowonly="people find this useful" />
    <txp:cbe_helpful_no labelshowonly="people find this useless" />
  </txp:cbe_helpful>
<txp:else />
  <txp:cbe_helpful>
    <txp:cbe_helpful_yes />
    <txp:cbe_helpful_no />
  </txp:cbe_helpful>
</txp:if_article_list>

Changelog

  • 30 Apr 13 - v0.6
  • 18 Jul 12 -v0.5.1- Fixed: path for /?rah_external_output=cbe_helpful_{js|ajax} - thx douglgm
  • 16 Jul 12 - v0.5 - Now supports rah_external_output v1.0 new db structure. Previous structure is no longer supported. Plugin not activated if an error occurs on rah_external_output controls. Checks if all tables are present and restore them if not.
  • 30 May 12 - v0.4 - Total votes - thx milosevic, list based on time - thx tye, fixed: miscalculation in cbe_helpful_list when sorting on score
  • 04 Jan 12 - v0.3 - fixed: unwanted markup if just displaying score, thx milosevic; fixed: cbe_helpful_label not working if standalone; fixed: avoid multiple calls to _cbe_helpful_foot when displaying a list; JS code slightly revisited
  • 19 Jul 11 -v0.2.1- fixed: non-valid html output for article id and unit - thx Pat64
  • 13 Jul 11 - v0.2 - cbe_helpful_list can now display cbe_helpful_score, cbe_helpful_yes, cbe_helpful_no; fixed: bug in list sorting when using ratio or percent display; repopulate table prefs with defaults if damaged or destroyed
  • 12 Jul 11 -v0.1.1- Added control on value returned by getRows (cbe_helpful_list)
  • 08 Jul 11 - v0.1 - Initial release

Sur les mêmes thèmes

cbe_swap_body_excerpt | cbe_if_prod_status | cbe_output_form | Exemples pour cbe_members | cbe_members | Exemples pour cbe_frontauth | cbe_frontauth | cbe_keywords | MonEcharpe | cbe_if_variable

Ce que vous en pensez

Patrick, le 19/07/2011 15:38 (#)

Merci pour ce plugin.

Une wishlist sur anazon serait une solution pour te remercier élégamment ;)

Claire Brione, le 19/07/2011 15:58 (#)

Pas de quoi !

Ma wishlist amazon en a été réveillée :)

Rechercher

Vous aimez...

... ce que je fais, ce que je suis. Ça vous est utile ou juste agréable. Vous voulez dire merci, alors

dites-le avec un livre

Tags

À propos

Je suis développeur web : je crée des sites Internet et en développe les fonctionnalités. Suite →

Mentions légales

Claire Brione
6 Chemin de l’Eglise14170 Vendeuvre – (Caen – Calvados)
SIRET : 412 079 550 00023 Suite →