Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#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
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)
Offline
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);
Hmm… sorry for formatting, haven’t time for this.
Enjoy! ;-)
Last edited by ekutsenko (2005-12-14 04:25:41)
Offline
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
$catnamewith$cattitlein 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 Releasefunction 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 ‘.$cattitle.’”>’.$cattitle.’</a>’.$catcnt.’</li>’.n;
}
}
$out[] = ‘</ul>’.n;
return implode(‘’, $out);
}
</code></pre></div>
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)
Offline
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[] = ‘<ul’.$listclass.’>’.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[] = ‘<li><a href=”’.hu.$linktosection.’?c=’.urlencode($catname).’” title=“View all links filed under ‘.$cattitle.’”>’.$cattitle.’</a>’.$catcnt.’</li>’.n;
}
}
$out[] = ‘</ul>’.n;
return implode(‘’, $out);
}
</code></pre></div>
<br />
<br />
Cheers,
Charles
Charles Roper
Offline