Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2005-11-14 21:19:44

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: [plugin] [ORPHAN] rss_linkcat_list

hello -

I am using mem_glinklist and rss_linkcat_list to try and create an easy to navigate list of link categories. I have read all of the support docs and searched through the forums, but just cannot figure out how to use rss_linkcat_list and mem_glinklist in conjunction with one another.

Currently (see link below), if you click on a category, it will link with the ?c=xxx parameter (which doesn’t return a filtered list… it only displays my links page with all of the categories and all of the links as it was before).

This is the page I am working with: <a href=“http://www.snapnashville.org/resources”>http://www.snapnashville.org/resources</a>

This is the code in the left column on this page:

<code>
<ul> <txp:rss_linkcat_list linktosection=“resources” />
</ul>
</code>

This is the code in the main content area column:

<code><txp:mem_glinklist form=“Links” columnwraptag=“ul” /></code>

All of the support materials say you can use these plugins in conjunction with one another to create list of links that will filter by category… but I can’t find anything anywhere that really explains how to use them in conjunction with one another. The mod that is mentioned… seems to only apply to tfu_linklog… but i’m not sure.

I’m lost! please help!

Thanks,
Stacey

Offline

#14 2005-11-14 21:38:10

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

Re: [plugin] [ORPHAN] rss_linkcat_list

@ photonomad

Read my three post above yours! (or keep reading this one).
I did have the same problem that you and it took me a few hours to find out how to finally get filtered lists of links. The documentation is a bit unclear in how to use this plug-in. But I like that lack in the documentation… it’s good to learn more about TXP :D .

Simple:
<code>
<txp:if_category>
<txp:mem_glinklist form=“Links” argname=“c” />
<txp:else />
<txp:mem_glinklist form=“Links” />
</txp:if_category>
</code>

(i have removed some attributes for brevity and clarity)

All the code I post above means:
if we are inside a category context, show links for the category in the URL. Else (if we are not in a category context), show the full linklist.

Notice there is a attribute argname="c" in the first mem_glinklist. It means: “pass to mem_glinklist the value of the category in the URL”.
It’s the same as if you use “category” attribute for mem_glinklist, but with the big difference that this variable is passed dynamically from the current URL, making the linklist context-sensitive! :D

So, the rss_linkcat_list generate the link category list with URLs that have the variable (?c=category) and mem_glinklist picks up that variable and generate the linklist from the category.

Finally, you can change the line that follows txp:else to whatever you want to show when you are in the section frontpage (/resources in your site).

Tell me if this works for you.

Last edited by maniqui (2005-11-15 04:40:57)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#15 2005-11-15 04:31:18

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: [plugin] [ORPHAN] rss_linkcat_list

maniqui

Thank you for being patient with me! wow… right in front of my eyes. I was lost and could not wrap my head around URL variables, the argname=“c”, etc.

Your explaination really helped!

Thanks so much,
- Stacey

Offline

#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