Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-23 20:10:27

mikewest
Archived Plugin Author
From: Deutschland
Registered: 2006-04-09
Posts: 16
Website

[plugin] [ORPHAN] mcw_ma_gnolia

<p><code>mcw_ma_gnolia</code> is a TextPattern plugin that generates a customizable Ma.gnolia link roll for use on your website. I’ve been using it on <a href=‘http://mikewest.org/’>my 4.0.3 installation</a> for some time now, and I think it’s ready for a public release. <a href=“http://mikewest.org/file_download/8” title=”`mcw_ma_gnolia` download”>Download version 0.4 now</a>, and start playing!</p>

<p><a href=“http://ma.gnolia.com” title=“ma.gnolia.com: a social bookmarking site”>Ma.gnolia</a> is a social bookmarking site (somewhat like <a href=“http://del.icio.us” title=“del.icio.us: a social bookmarking site”>del.icio.us</a>) that I use to keep track of interesting websites I come across. It provides the built in ability to display your most recent bookmarks on your personal website (a ‘link roll’), but I don’t like the mechanism it uses to make that happen.</p>

<p><a href=“http://ma.gnolia.com” title=“ma.gnolia.com: a social bookmarking site”>Ma.gnolia</a> provides you with a JavaScript file that uses <code>document.write</code> to dump the link roll to your site. This works, but it’s not exactly accessible, nor is it very flexible. <code>mcw_ma_gnolia</code> leverages this built-in mechanism to provide what I hope is an extremely flexible and accessible link roll without the use of client-side JavaScript.</p>

<p>In a nutshell, the plugin downloads and caches the JavaScript file server-side on a quasi-hourly basis, extracts the link information, and makes the data available for you via a series of TextPattern tags that you can use in your <code>forms</code> and <code>pages</code>.</p>

<p>Start by <a href=“http://mikewest.org/file_download/8” title=”`mcw_ma_gnolia` download”>downloading the plugin</a> and installing it like you would any other. Once you’ve gotten the plugin installed, <code>edit</code> it, and enter your ma.gnolia username and the number of links you’d like displayed into the public config section of the PHP code (should be lines 6 and 7 or so). If you don’t do this, you’ll be seeing my links. That’s a fine way to test, but you’ll probably want to make this change before you go live.</p>

<p>Next, click on the <code>extensions</code> tab, and then on the <code>Ma.gnolia Linkroll</code> subtab. Hitting this page will automatically create a <code>form</code> called <code>mcw_ma_gnolia</code>, and offer you the opportunity to force-update your cached ma.gnolia links. Go ahead and hit that button now to speed things up later.</p>

<p>Finally, edit a <code>page</code> to include the <code>&lt;txp:mcw_ma_gnolia /&gt;</code> tag. Viola, ma.gnolia links on your page. Astounding!</p>

<p>Now, how do you customize the output? Excellent question. Here’s brief documentation of each of the tags this plugin enables:</p>

<ul>
<li><code>txp:mcw_ma_gnolia</code> — The <code>mcw_ma_gnolia</code> tag is a <em>single tag</em> that gets replaced with the Link Roll. It can be included on a <code>page</code> directly, or as part of a <code>form</code> that’s displayed on a page. It has several attributes:
<ul><li><code>form</code> — this specifies the <code>form</code> to be used for each of the
displayed links. Defaults to <code>mcw_ma_gnolia</code>.</li> <li><code>wrap_tag</code> — specifies the block-level tag to wrap the links. Defaults to <code>ul</code>.</li> <li><code>class</code> — applies a CSS class to the block-level tag specified in the <code>wrap_tag</code> attribute.</li></ul></li> <li><code>txp:mcw_ma_gnolia_uri</code> — The <code>mcw_ma_gnolia_uri</code> tag is a <em>single tag</em> that gets replaced with a link’s URI (the actual address of the link).</li>
<li><code>txp:mcw_ma_gnolia_link</code> — The <code>mcw_ma_gnolia_link</code> tag is a <em>single tag</em> that gets replaced with a link’s ma.gnolia redirect (e.g. http://ma.gnolia.com/bookmarks/bupuxeseq/dispatch)</li>
<li><code>txp:mcw_ma_gnolia_title</code> — The <code>mcw_ma_gnolia_title</code> tag is a <em>single tag</em> that gets replaced with a link’s title.</li>
<li><code>txp:mcw_ma_gnolia_desc</code> — The <code>mcw_ma_gnolia_desc</code> tag is a <em>single tag</em> that gets replaced with a link’s description.</li>
</ul>

<p>Example page:</p>

<pre><code>Page: default

… &lt;div id=‘ma_gnolia_linkroll’&gt; &lt;h2&gt;My Recent Bookmarks&lt;/h2&gt; &lt;txp:mcw_ma_gnolia form=‘mcw_ma_gnolia’ wrap_tag=‘ol’ class=‘ma_gnolia_list’ /&gt;

&lt;/div&gt; … </code></pre>

<p>Example form:</p>

<pre><code>Form: mcw_ma_gnolia

&lt;li&gt; &lt;a href=’&lt;txp:mcw_ma_gnolia_link /&gt;’ title=’&lt;txp:mcw_ma_gnolia_title /&gt;’ &gt;&lt;txp:mcw_ma_gnolia_title /&gt;&lt;/a&gt; – &lt;txp:mcw_ma_gnolia_desc /&gt;

&lt;/li&gt;
</code></pre>

<p>Would produce:</p>

<pre><code>&lt;div id=‘ma_gnolia_linkroll’&gt; &lt;h2&gt;My Recent Bookmarks&lt;/h2&gt; &lt;ol class=‘ma_gnolia_list’&gt;

&lt;li&gt; &lt;a href=‘LINK_GO_HERE’ title=‘TITLE_GO_HERE’ &gt;TITLE_GO_HERE&lt;/a&gt; – DESCRIPTION GO HERE &lt;/li&gt; … &lt;li&gt; &lt;a href=‘LINK_GO_HERE’ title=‘TITLE_GO_HERE’ &gt;TITLE_GO_HERE&lt;/a&gt; – DESCRIPTION GO HERE &lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; </code></pre>

<p>Nice, eh?</p>

Last edited by mikewest (2006-06-17 15:56:45)

Offline

#2 2006-04-24 08:16:45

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 256
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

Excellent plugin!

I have a question, though. Can you limit the number of bookmarks which are output in the linkroll?


Prrrrrrrr

Offline

#3 2006-04-24 15:23:50

mikewest
Archived Plugin Author
From: Deutschland
Registered: 2006-04-09
Posts: 16
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

TNT: you can edit the number of links returned in the same place you edit the username. e.g. edit the plugin code, and change line 6 or 7 accordingly. Is that what you’re looking for?

-Mike

Offline

#4 2006-04-24 17:31:09

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 256
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

Yes, that’s what I was looking for! Thanks again for the plugin.


Prrrrrrrr

Offline

#5 2006-04-24 18:03:33

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 256
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

I think I’ve found a small bug… When using the txp:mcw_ma_gnolia_uri tag, the url of the link is not working. Instead, it links to my own index-page.

It is supposed to link to original url (instead of the url made by ma.gnolia), right?


Prrrrrrrr

Offline

#6 2006-04-24 18:39:01

mikewest
Archived Plugin Author
From: Deutschland
Registered: 2006-04-09
Posts: 16
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

Hrm. Yup, that’s a typo on my part. I’ve been using the Ma.gnolia link, and apparently didn’t test the uri very well (read: at all). :)

Luckily it’s an easy fix:

Replace the line:

function mcw_ma_gnolia_uri()   { return mcw_ma_gnolia_data('uri'); }

with:

function mcw_ma_gnolia_uri()   { return mcw_ma_gnolia_data('url'); }

In other words, change the ‘i’ of ‘uri’ to an ‘l’. Trivial, eh? I’ll package that up shortly and push out a new version.

-Mike

Offline

#7 2006-04-25 08:05:07

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 256
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

Thanks!


Prrrrrrrr

Offline

#8 2006-04-25 17:18:26

mikewest
Archived Plugin Author
From: Deutschland
Registered: 2006-04-09
Posts: 16
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

Version 0.2 is out, and it corrects the bug TNT noted above. Enjoy!

-Mike

Offline

#9 2006-04-26 17:19:33

mikewest
Archived Plugin Author
From: Deutschland
Registered: 2006-04-09
Posts: 16
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

Version 0.3 is out, adding the ability to filter the links in your linkroll by a specific tag, and changing the link retrieval mechanism so that it functions correctly on more servers.

-Mike

Offline

#10 2006-06-17 15:55:32

mikewest
Archived Plugin Author
From: Deutschland
Registered: 2006-04-09
Posts: 16
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

<a href=‘http://mikewest.org/file_download/8’>Version 0.4 is out</a>, tweaking the plugin to work with Ma.gnolia’s new linkroll JavaScript. This, of course, is a good reason to start working on something that actually uses the Ma.gnolia API instead of parsing through a linkroll JavaScript file. I’ll be starting on that soon.

-Mike

Offline

#11 2006-06-20 00:35:35

tkn
Member
From: New York
Registered: 2004-06-29
Posts: 39
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

Getting an error with this plugin when I use the extensions page:

Notice: Undefined offset: 1 in /public_html/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 158

Notice: Undefined offset: 1 in /public_html/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 159

Notice: Undefined offset: 2 in /public_html/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 160

Notice: Undefined offset: 3 in /public_html/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 161

Notice: Undefined offset: 1 in /public_html/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 158

Notice: Undefined offset: 1 in /public_html/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 159

Notice: Undefined offset: 2 in /public_html/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 160

Notice: Undefined offset: 3 in /public_html/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 161

Offline

#12 2006-06-20 05:56:09

mikewest
Archived Plugin Author
From: Deutschland
Registered: 2006-04-09
Posts: 16
Website

Re: [plugin] [ORPHAN] mcw_ma_gnolia

tkn, what’s your ma.gnolia username? I’m wondering if they’re playing with different RSS feed formats for different users or something similar…

again, this is a great reason to use the ma.gnolia API, and I’m hoping to have a new version out in a week or two that does just that.

-mike

Offline

Board footer

Powered by FluxBB