Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-05-13 13:05:24

Slaktad
Archived Plugin Author
From: Linköping, Sweden
Registered: 2005-06-28
Posts: 50
Website

joh_flattr: Display a Flattr button on your Txp site

This plugin displays a Flattr button where the <txp:joh_flattr />-tag is used.

Dowload joh_flattr

Example usage:

<txp:joh_flattr uid="1234" title="My flatter entry title" description="The description of the flatter entry" />

Parameters

  • uid Your personal Flattr user id. Required.
  • title The title of the thing you want to submit. Defaults to the article title and falls back to the sitename if omitted. The contents of a custom field named “joh_flattr_title” will override any default value or parameter value.
  • description The full excerpt of the content. Defaults to the article excerpt and falls back to the site slogan if there is no current article. The contents of a custom field named “joh_flattr_description” will override any default value or parameter value.
  • category The flattr category the content belongs to. You can choose between the following: text, images, video, audio, software, rest. Required. The contents of a custom field named “joh_flattr_category” will override any default value or parameter value.
  • language The language code of the submitted thing. Defaults to ‘en_GB’. See a list of supported language codes
  • tag Tag your Flattr thing. Multiple tags can be used by separating them with commas. The contents of a custom field named “joh_flattr_tag” will override any default value or parameter value.
  • url The URL of your Flattr thing. Defaults to the requested URL.
  • compact If this parameter is set to “true/1/something” the compact button type will be used.

I hope you’ll find it useful.

Offline

#2 2010-05-15 16:02:40

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: joh_flattr: Display a Flattr button on your Txp site

Makes sense. Thanks!

I have just activated my flattr account & money is on the way.
When will the button be activated? (your experience)

For debug reasons the following TXP code can be used as a base for double checking issues:

<script type="text/javascript">
var flattr_uid = 'your user ID here';
var flattr_tle = '<txp:title />';
var flattr_dsc = 'Here we need some wrapping PHP a) to strip all HTML and b) to get one line (necessary?). / This throws error because of HTML? <txp:if_excerpt><txp:excerpt /><txp:else /><txp:body /></txp:if_excerpt>';
var flattr_cat = 'text';
var flattr_lng = 'de_DE';
var flattr_tag = '<txp:keywords />';
var flattr_url = '<txp:permlink />';
var flattr_btn = '';
</script>
<script src="http://api.flattr.com/button/load.js" type="text/javascript"></script>

BTW: What happens if there is no excerpt?

description The full excerpt of the content. Defaults to the article excerpt and falls back to the site slogan if there is no current article. The contents of a custom field named “joh_flattr_description” will override any default value or parameter value.

On my site I have a section where I don’t use excerpts.
In this case the description is empty.
I could use rss_auto_excerpt but I have configured the plug-in not to strip <h4> tags which will lead to a flattr error because of the HTML and maybe because of the line breaks.

Last edited by merz1 (2010-05-15 16:22:48)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#3 2010-05-21 10:39:12

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: joh_flattr: Display a Flattr button on your Txp site

Updated my TXP code and created a misc. form ‘flattr_compact’:

To always create a clean excerpt as flattr_dsc I use the plug-in txp:rss_auto_excerpt. All other tags are TXP core.

<!-- compact Flattr button for single articles -->
<script type="text/javascript">
var flattr_uid = 'Your Flattr user ID';
var flattr_tle = '<txp:title />';
var flattr_dsc = '<txp:rss_auto_excerpt length="1000" stripbreakstabs="1" showlinkwithexcerpt="0" ending=" (...)" overrideexcerpt="1" striptags="1" linkwraptag="" excerptwraptag="" />';
var flattr_cat = 'text';
var flattr_lng = 'de_DE';
var flattr_tag = '<txp:keywords />';
var flattr_url = '<txp:permlink />';
var flattr_btn = 'compact';
</script>
<script src="http://api.flattr.com/button/load.js" type="text/javascript"></script>

HTML in excerpt: In my case I don’t strip the h4 tags but the javascript doesn’t throw an error because of these. The old code example above did throw a button error. Additionally I have seen entries on Flattr which contain HTML tags.

Edit:

  • Changed ending=” (More &hellip;)” to ending=" (...)" despite the fact that I see […] in Flattr descriptions.
  • Also var flattr_tag might need some additional if/else category code.

Done (added line breaks for better reading):

var flattr_tag = '
<txp:section title="1" />,
<txp:if_article_category number="1"><txp:category1 title="1" />,</txp:if_article_category>
<txp:if_article_category number="2"><txp:category2 title="1" />,</txp:if_article_category>
<txp:keywords />
';

This way you get the best tag line available as long as section titles and category titles make sense. To be on the safe side I use comma delimiting without spaces.

Last edited by merz1 (2010-05-27 17:48:16)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#4 2010-07-15 10:18:57

Turbo-G
Member
From: Würzburg, Germany
Registered: 2004-04-15
Posts: 27
Website

Re: joh_flattr: Display a Flattr button on your Txp site

Would it be possible to put the Flattr button into the RSS/Atom feed?

Offline

#5 2010-08-20 08:58:25

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 305
Website GitHub Twitter

Re: joh_flattr: Display a Flattr button on your Txp site

Hello,

for description I added the following line before the javascript code to meet the requirements

$description=substr(trim(strip_tags($description)),0,1000);

Offline

#6 2011-08-02 19:24:37

oelauge
Member
Registered: 2010-03-17
Posts: 24

Re: joh_flattr: Display a Flattr button on your Txp site

The link is broken. The Flattr plug-in is not more available. Is another source possible?

Offline

#7 2011-08-05 14:40:30

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: joh_flattr: Display a Flattr button on your Txp site

You don’t need a plug-in. My Flattr instruction above should basically work. Just check against the actual Flattr API (not optional).

And as many Flattr users do (I don’t use Flattr at the moment) the better way is to not use the script but to link via static image-button/link to the Flattr item/blog page.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

Board footer

Powered by FluxBB