Home page > SPIP > Flattr Plugin for SPIP

Flattr Plugin for SPIP

Friday 10 September 2010, by Fil

All the versions of this article: [English] [français]

This plugin helps integrate the microgift system Flattr in SPIP.


The plugin is developed on SPIP-Zone, available via Subversion:

svn co svn://zone.spip.org/spip-zone/_plugins_/flattr/

One can find a ZIP file at http://files.spip.org/spip-zone/fla...

Current Version: 0.2


The Flattr plugin for SPIP can be configured with CFG; one has to indicate the Flattr UserID that will receive the microgifts. The user can also specify the main type of contents that the site offers, in Flattr’s nomenclature: text, images, video, audio, software...


To integrate a Flattr button to your SPIP website, you can use a model article_flattr.html; there are two possibilities:
— inserting it here and there, in the body or the post-scriptum of an article: write <article67|flattr> in any text field;
— in a template (by example extra/article.html, by inserting the following: #MODELE{article_flattr,id_article}.

An other model allows you to flattr your site’s homepage: <site|flattr> or #MODELE{site_flattr}.

Note on javascript. Flattr offers a standard javascript button (https://flattr.com/support/integrate/js), but like a nark it sends a request from each of your visitors to flattr.com’ servers — which is unacceptable in terms of privacy. Hence we have developed an specific JS that only pings Flattr when the user intently hovers on the button. The main JS script is served by your site. If you want it to be served with every page (and compressed with the other JS form your site), you can add it to your inc-head file; if you don’t, it will be lazily loaded, only when needed.


The following are the default parameters for the button:
— title: the article’s title.
— description: the article’s description, limited to 1,000 chars.
— uid : User ID, as configured in CFG
— hidden: true or false (CFG)
— button: default
— tags: the article’s keywords
— category: text (or other, as defined in CFG)

It is always possible to modify those parameters by passing them explicitely to the model. For example, if article 67 is a video, one can write:


If an article should flattr another author than the UserID defined in CFG, one can explicitly pass its uid to the model:


All other parameters are handled in a similar fashion.

Note: if you don’t create your ‘things’ by hand in Flattr’s interface, they will be created when they receive a first microgift. As soon as an article (identified by its canonical URL) has been created in Flattr, its parameters are frozen (you can still edit them from Flattr’s dashboard, of course).


The button is demoed here:

Flattr Plugin for SPIP