Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2005-11-30 06:08:11

joji
New Member
Registered: 2005-11-30
Posts: 4

Re: [plugin] [ORPHAN] rss_linkcat_list

I registered in the forum so I can say: Thank you very much!! Very helpful.


Thanks to Textpattern.

Offline

#17 2005-12-12 16:45:44

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] rss_linkcat_list

Could it be possible to add support for category titles?

A bump!

I think Wilshire is very busy to take care of this feature request.

Maybe someone with great experience in plug-in development (I’m looking at you… well, you know who you are… ) can give a quick look into the plug-in code and come back to this thread and suggest a mod for this plug-in to support category titles.

:D
Gracias!.

Last edited by maniqui (2005-12-12 16:46:15)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#18 2005-12-14 04:20:59

ekutsenko
Member
From: Ukraine
Registered: 2005-08-16
Posts: 11
Website

Re: [plugin] [ORPHAN] rss_linkcat_list

Okay, man, here it is! This is how it should looks like with title support:

<code>
function rss_linkcat_list($atts) { global $s, $c, $url_mode, $pretext, $siteurl, $id; extract($atts);

$linktosection = isset($linktosection) ? $linktosection.”/” : “”; $showcount = isset($showcount) ? $showcount : “0”; $q = ‘SELECT DISTINCT name,title FROM ‘.PFX.‘txp_category, ‘.PFX.‘txp_link WHERE name !=“default” and type=“link” and category = name ORDER BY name’; $rsc = getRows($q,”“); $repl = array(“/”, “ “); $rs = getRows($q,”“); if ($rs) { $out[] = ‘<ul>’; foreach($rs as $a) { extract($a); $catname = $a[“name”]; $cattitle = $a[“title”]; if ($showcount) { $q = “SELECT COUNT count FROM “.PFX.“txp_link WHERE category=’$catname’”; $rs = getRows($q); $catcnt = “ (“.$rs0[‘count’].”)”; } else { $catcnt = “”; } $out[] = ‘<li><a href=”’.hu.$linktosection.’?c=’.urlencode($catname).’” title=“View all links filed under ‘.$catname.’”>’.$cattitle.’</a>’.$catcnt.’</li>’.n; } } $out[] = ‘</ul>’.n; return implode(‘’, $out); } </code>

Hmm… sorry for formatting, haven’t time for this.

Enjoy! ;-)

Last edited by ekutsenko (2005-12-14 04:25:41)

Offline

#19 2005-12-14 05:03:34

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [plugin] [ORPHAN] rss_linkcat_list

Hi ekutsenko!
Thank you very much! it works like a charm!

I have “improved” it a little, by comparing the original plug-in with your great mod, line by line:

  • replaced $catname with $cattitle in the title attribute in the link
  • removed some “custom” HTML code that isnt in the original plug-in (<sup><a href="#fn0">0</a></sup>) (maybe a mistake? That code doesnt seems to make any sense for me)

So, here is the code:

<div style=“font-size:85%;overflow:auto;”><pre><code>// rss_linkcat_list // by Rob Sable // http://www.wilshireone.com // Version 0.1 – 04/20/2005 – Initial Release

function rss_linkcat_list($atts) { global $s, $c, $url_mode, $pretext, $siteurl, $id; extract($atts);

$linktosection = isset($linktosection) ? $linktosection.”/” : “”; $showcount = isset($showcount) ? $showcount : “0”;

$q = ‘SELECT DISTINCT name,title FROM ‘.PFX.‘txp_category, ‘.PFX.‘txp_link WHERE name !=“default” and type=“link” and category = name ORDER BY name’; $rsc = getRows($q,”“); $repl = array(“/”, “ “);

$rs = getRows($q,”“);

if ($rs) { $out[] = ‘&lt;ul&gt;’; foreach($rs as $a) { extract($a); $catname = $a[“name”]; $cattitle = $a[“title”];

if ($showcount) { $q = “SELECT COUNT count FROM “.PFX.“txp_link WHERE category=’$catname’”; $rs = getRows($q); $catcnt = “ (“.$rs0[‘count’].”)”; } else { $catcnt = “”; }

$out[] = ‘&lt;li&gt;&lt;a href=”’.hu.$linktosection.’?c=’.urlencode($catname).’” title=“View all links filed under ‘.$cattitle.’”&gt;’.$cattitle.’&lt;/a&gt;’.$catcnt.’&lt;/li&gt;’.n; } } $out[] = ‘&lt;/ul&gt;’.n; return implode(‘’, $out);
}
</code></pre></div>

<br /> <br />

Thank you so much again, and I hope wilshire will add your mod to the next official release of this plug-in.

Last edited by maniqui (2005-12-14 05:12:00)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#20 2006-02-10 21:00:32

charlesroper
Member
From: Hastings, UK
Registered: 2004-08-01
Posts: 25
Website

Re: [plugin] [ORPHAN] rss_linkcat_list

I’ve just got to grips with this plugin – thanks maniqui for the posts explaining the finer details. Thanks also to ekutsenko for the mod and thanks also to Rob, of course, for writing the thing in the first place. :)

I needed to add a class to the ul generated by the plugin, so I’ve made my own little mod. It simply adds a listclass attribute to the tag. This is my first foray into hacking a plugin, so what I’ve done may be a load of old cobblers, but it seems to work for me. Here’s the updated code:

<div style=“font-size:85%;overflow:auto;”><pre><code>// rss_linkcat_list
// by Rob Sable
// http://www.wilshireone.com
// Version 0.1 – 04/20/2005 – Initial Release

function rss_linkcat_list($atts) { global $s, $c, $url_mode, $pretext, $siteurl, $id; extract($atts);

$linktosection = isset($linktosection) ? $linktosection.”/” : “”; $showcount = isset($showcount) ? $showcount : “0”; $listclass = isset($listclass) ? ‘ class=”’.$listclass.’”’ : “”;

$q = ‘SELECT DISTINCT name,title FROM ‘.PFX.‘txp_category, ‘.PFX.‘txp_link WHERE name !=“default” and type=“link” and category = name ORDER BY name’; $rsc = getRows($q,”“); $repl = array(“/”, “ “);

$rs = getRows($q,”“);

if ($rs) { $out[] = ‘&lt;ul’.$listclass.’&gt;’.n; foreach($rs as $a) { extract($a); $catname = $a[“name”]; $cattitle = $a[“title”];

if ($showcount) { $q = “SELECT COUNT count FROM “.PFX.“txp_link WHERE category=’$catname’”; $rs = getRows($q); $catcnt = “ (“.$rs0[‘count’].”)”; } else { $catcnt = “”; }

$out[] = ‘&lt;li&gt;&lt;a href=”’.hu.$linktosection.’?c=’.urlencode($catname).’” title=“View all links filed under ‘.$cattitle.’”&gt;’.$cattitle.’&lt;/a&gt;’.$catcnt.’&lt;/li&gt;’.n; } } $out[] = ‘&lt;/ul&gt;’.n; return implode(‘’, $out);
}
</code></pre></div>
<br />
<br />

Cheers,

Charles


Charles Roper

Offline

Board footer

Powered by FluxBB