Textpattern Forum

You are not logged in. Register | Login | Help

#191 2006-02-23 20:50:16

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: mem_glinklist: Grouped Link List

To be usable with if_category, you will need to set argname=“c”. The category argument used by txp is “c”. I intentionally made this plugin use “lc” because I wanted it to be possible to distinguish between a txp generic category verses my plugin’s category.

Offline

#192 2006-02-23 21:11:07

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,976
Website

Re: mem_glinklist: Grouped Link List

Thanks Manfre for your quick reply.
We are on the road again. Still a problem to solve in mem_categories for this to work.

When using this code:

<txp:mem_categories type="link" form="linkcatlist" argname="lc" />
.
the output is for the created “filter by category” link is

<a href="http://www.midi-midi.com.ar/enlaces/?lc=categoryname">categorytitle</a>
.
BUT when using:

<txp:mem_categories type="link" form="linkcatlist" argname="c" />
.
The output is for the link to “filter by category”:

<a href="http://www.midi-midi.com.ar/enlaces/category/categoryname">categorytitle</a>
.
So, then, when clicking in the link, nothing happens, because m_glinklisk is expecting for an URL that finish in “?c=categoryname” but it gets one with “/category/categoryname”

Last edited by maniqui (2006-02-23 21:35:48)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#193 2006-02-23 22:19:24

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,976
Website

Re: mem_glinklist: Grouped Link List

Well, Manfre, I finally find the solution in the code of the plug-in

There is a part of the plug-in code that is:

<pre><code>
// Remove the next three ‘//’ to enable clean urls
// if ($permlink_mode==‘messy’ or $argname==‘lc’) $href = $baseurl . ‘?’.$argname.’=’.urlencode($parent[‘name’]);
// else
// $href = $baseurl . ‘category/’.urlencode($name);

if (empty($thing)) $thing = $parent[‘title’];

return tag(str_replace(“& “,”& “, $thing),‘a’,’ href=”’.$href.’” title=”’.$parent[‘title’].’”’);
}

function mem_cat_link($atts,$thing=’‘)
{ global $permlink_mode,$thiscategory;

extract(lAtts(array( ‘class’ => FUNCTION, ‘argname’ => ‘’, ‘baseurl’ => hu ),$atts)); extract($thiscategory);

if (!isset($argname) or empty($argname)) { $argname = ($type==‘link’) ? ‘lc’ : ‘c’; }

// Remove the next three ‘//’ to enable clean urls if ($permlink_mode==‘messy’ or $argname==‘lc’) $href = $baseurl . ‘?’.$argname.’=’.urlencode($name); else $href = $baseurl . ‘category/’.urlencode($name);

if (empty($thing)) $thing = $title;

return tag(str_replace(“& “,”& “, $thing),‘a’,’ href=”’.$href.’” title=”’.$title.’”’);
}</code></pre>

So, I commented the last chunk, in this way:

<pre><code>
// Remove the next three ‘//’ to enable clean urls
// if ($permlink_mode==‘messy’ or $argname==‘lc’) $href = $baseurl . ‘?’.$argname.’=’.urlencode($name);
// else
// $href = $baseurl . ‘category/’.urlencode($name);

if (empty($thing)) $thing = $title;

return tag(str_replace(“& “,”& “, $thing),‘a’,’ href=”’.$href.’” title=”’.$title.’”’);
}</code></pre>

And now, my urls, when using argname="c", are outputted as expected.
And the “filter by category” links (mem_categories) are working as expected with m_glinklist.

Thanks for your patience.

Last edited by maniqui (2006-02-27 21:41:43)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#194 2006-04-06 00:19:41

tinyfly
Member
From: Dallas, Texas
Registered: 2004-05-10
Posts: 462
Website

Re: mem_glinklist: Grouped Link List

manfre, I have a feature request. Could you add an attribute like showchildren? That way I could specify a top level category and your plugin would generate a list from all child categories also.

What do you think?

Offline

#195 2006-04-07 19:13:59

obley
New Member
From: Champaign, IL
Registered: 2006-04-07
Posts: 7
Website

Re: mem_glinklist: Grouped Link List

tinyfly wrote:

manfre, I have a feature request. Could you add an attribute like showchildren? That way I could specify a top level category and your plugin would generate a list from all child categories also.
What do you think?

yea… I jsut read all 8 pages looking for this exact feature. What I am looking for is a display of all links in the specified category plus child categories while never displaying sibilings or parents.

That would be super sweet.

make sense?

Offline

#196 2006-04-07 20:25:25

obley
New Member
From: Champaign, IL
Registered: 2006-04-07
Posts: 7
Website

Re: mem_glinklist: Grouped Link List

ok, so I’ve poked around and forced a solution until Manfre makes a better one, if he deems worthy.

(made a better solution in my next post…)
on line 431 of version .8.5 you will find the mem_get_all_categories() function. Just replace ‘root’ with the catagory name you want to act as root.

I’ve noticed that this will not display links from that catagory, only links in child catagories. I’m cool with that since I intened to keep my links organized in such a fashion. This also still displays links in the root catagory as unclassified but that can be disabled with already existing attributes.

I woudl like to make a “catroot” attribute so the catagory root can be changed dynamically but don’t know php well enough to swing it. I’ll keep cracking at it unless someone tells me I’m way off or offers a better solution.

Thanks Manfre, lov’n it!

Last edited by obley (2006-04-12 01:44:13)

Offline

#197 2006-04-12 02:25:53

obley
New Member
From: Champaign, IL
Registered: 2006-04-07
Posts: 7
Website

Re: mem_glinklist: Grouped Link List

ok, I’ve modified a function and its call to create a dynamic “root” and it works pretty well for me.

This accepts a new variable called catroot holdint the value of the catagory you want to be the base. It still lists all loose tags in root and I’m not sure how to get it to stop that.

what I changed….

lines 66 and 67 become this:
<pre><code> ‘catform’ => ‘’, ‘catroot’ => ‘root’
</code></pre>

line 79:
<pre><code> $cats = mem_get_all_categories(‘link’, $catroot);
</code></pre>

line 431:
<pre><code>
function mem_get_all_categories($type, $root)
</code></pre>

line 436:
<pre><code> $rs = getTree($root,$type);
</code></pre>

and finally line 441:
<pre><code> $out[‘name’][] = ($name==$root?’‘:$name);
</code></pre>

You can see this in action with two seperate trees using different roots here and eventually over there

Offline

#198 2006-04-21 21:57:55

viewchange
New Member
Registered: 2005-07-30
Posts: 5

Re: mem_glinklist: Grouped Link List

Link Wrap Tag

I wanted a way to wrap each link of the listing with a tag such as li. I confess I didn’t read all the pages of this post. Perhaps the plugin does it natively or there is a better way to do this? I suppose you could just include the tag in the link form (this didn’t occurr to me until after modding the plugin).

Anyhow, I added the attributes linkwraptag and linkclass

Around line 50…

<code> extract(lAtts(array( ‘category’ => ‘’, ‘columns’ => ‘1’, ‘form’ => ‘’, ‘limit’ => ‘0’, ‘sort’ => ‘linksort’, ‘headless’ => false, ‘uncategorized’ => ‘Uncategorized’, ‘linkwraptag’ => ‘li’, ‘listwraptag’ => ‘ul’, ‘headwraptag’ => ‘div’, ‘columnwraptag’ => ‘div’, ‘linkclass’ => ‘mem_link’, ‘listclass’ => ‘mem_list’, ‘headclass’ => ‘mem_list_head’, ‘columnclass’ => ‘mem_list_column’, ‘sortbycat’ => false, ‘argname’ => ‘’, ‘catform’ => ‘’ ),$atts));
</code>

And later in the file around line 160…

<code> foreach ($slice as $l) { extract($l);

$surl = htmlspecialchars($url); $link = ‘<a href=”’.$surl.’”>’.$linkname.’</a>’; $linkdesctitle = ‘<a href=”’.$surl. ‘” title=”’.$description.’”>’.$linkname.’</a>’;

$cl = $Form;

$cl = str_replace(“<txp:link />”, $link, $Form); $cl = str_replace(“<txp:linkdesctitle />”, $linkdesctitle, $cl); $cl = str_replace(“<txp:link_description />”, $description, $cl);

//added linkwraptag $cl = doTag($cl,$linkwraptag,$linkclass).n;

$GLOBALS[‘thislink’] = $l; $col_out .= parse($cl); unset($GLOBALS[‘thislink’]); }
</code>

Hope someone finds it useful.

Brian

Offline

#199 2006-04-22 01:56:15

obley
New Member
From: Champaign, IL
Registered: 2006-04-07
Posts: 7
Website

Re: mem_glinklist: Grouped Link List

viewchange, this could have been done without code manipulation using a form.

This is how I acomplish the very same thing:

<code><txp:mem_glinklist form=“Links” columnwraptag=“ul” uncategorized=”&nbsp;” catroot=“linkage” listclass=“linkage” /></code>

and then the form links contains:

<code><li><txp:linkdesctitle /><span><txp:link_description /></span></li></code>

but I understand that sometimes its just more fun to mess with the source code ;)

Offline

#200 2006-04-24 12:56:12

viewchange
New Member
Registered: 2005-07-30
Posts: 5

Re: mem_glinklist: Grouped Link List

obley — good point, wasn’t until after messing with the code that I realized it could be done via the form. Oh well. Though it was a good primer to the world of TXP plugins!

-Brian

Offline

Board footer

Powered by FluxBB