You are not logged in.
Here’s a cleaner approach that allows you to indicate how accurate the value has to be. This probably won’t be in the plugin releases.
<pre><code>
function mem_if_category_empty($atts,$thing)
{
extract(lAtts(array(
‘type’ => ‘link’,
‘name’ => ‘’,
‘argname’ => ‘’,
‘tolerance’ => 0,
),$atts));
if (empty($name)) { if (!empty($argname)) $name = gps($argname); else return; }
if (!is_numeric($tolerance)) $tolerance = 0;
$tolerance = abs(intval($tolerance));
$count = mem_get_cat_count($type,$name) – $tolerance;
$condition = $count<=0;
return parse(EvalElse($thing, $condition));
}
</code></pre>
Offline
Thanks Manfre, works perfectly.
Refresh Dallas and other Refreshing Cities.
Offline
Hi,
I love this plugin! Thanks so much Manfre!
I do have a little problem The Uncategorized links are not working. I’m not sure if I’m the culprit or if there is a problem with the plugin. I’m running Textpattern version: 4.0.1 (r888) I read through all of the help document… was a bit confused… tried to make my mem_glinklist tag as “default” as possible though.
This is an example of the code that mem_glinklist outputs for one of my categorized links:
<code>
<div class=“mem_list”><div class=“mem_list_head”>Art Related Links</div>
<ul class=“mem_list_column”> <li>
<div class=“link_title”><a href=“http://www.artsnashville.org/index.html”>Metro Nashville Arts Commission</a></div>
<div class=“link_desc”></div>
</li>
</ul>
</div>
</code>
This is an example of what happens to a link when it is uncategorized:
<code>
<div class=“mem_list”><div class=“mem_list_head” />
<ul class=“mem_list_column”> <li>
<div class=“link_title”><a href=“http://www.photonomad.com”>Photonomad</a></div>
<div class=“link_desc”>A link to Stacey Irvin’s site.</div>
</li>
</ul>
</code>
The tag that calls mem_glinklist on my links page:
<code>
<txp:mem_glinklist form=“Links” columnwraptag=“ul” />
</code>
I also tried it with uncategorized=“Other” and the same thing happens.
<code>
<txp:mem_glinklist form=“Links” columnwraptag=“ul” uncategorized=“Other” />
</code>
This is the “Links” form:
<code>
<li>
<div class=“link_title”><txp:link /></div>
<div class=“link_desc”><txp:link_description /></div>
</li>
</code>
Thanks in advance and sorry if I’ve just missed something obvious.
- Stacey
Offline
I posted this at textpattern.org earlier, but if it was unnoticed, here my question is again:
Would it be possible to exclude certain categories from the listing? I have a case where I want to list 50+ categories at once and then later in the template just one (“Other”). The problem is that Other shows up in the big listing too, not ideal..
TIA,
/Anton
Offline
I like to use stw_category_tree in the cases where I want specific categories to show. I’m not sure if mem_glinklist can do what you ask.
Refresh Dallas and other Refreshing Cities.
Offline
me too. but even that plugin has exclude ability, AFAIK. the trouble is not to show what I want, but to hide a specific category. there’s a subtle difference there, in my case at least. :)
Offline
@anton, I’ll add support to exclude items. It may be in the form of an tag attribute or an if tag. Not sure yet, but i’ll let you know. No eta, but adding to the to-do list.
@stacey, that appears to be a bug and will be fixed.
Offline
I’m trying to generate a “filter links by category” list.
I used to use the rss_linkcat_list plug-in but I have found that it seems to be possible to achieve the same using mem_glinklist, or am I wrong?
I have a section like “www.mydomain.com/links/”
I’m using the <txp:mem_categories /> tag to output the categories list.
But the generated links point to “www.mydomain.com/?lc=services”. So, when you click, you get the homepage again.
The category links should point “www.mydomain.com/<b>links</b>/?lc=services”, but I dont know how to generate them with the /link/ …
The rss_linkcat_list has the linktosection="" attribute… so, i’m looking for something similar en mem_glinklist or more exactly, in mem_categories
any ideas? thanks in advance
Last edited by maniqui (2006-02-16 19:41:12)
Offline
While waiting for a solution, I will use the combination of rss_linkcat_list + mem_glinklist that works flawlessly.
But if someone (Manfre? r u there?) points me in the right direction to do the same with mem_glinklist, I would be able to reduce my plug-in list by one (no needing of rss_linkcat_list).
thanks.
Offline