Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#73 2005-05-27 20:16:22

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

Re: [Archived] stw_category_tree

I am having a problem with outputing the count number. It always shows (0) as the count no matter how many links I have. Here is how I am using the tag:

<code><txp:stw_category_tree prune=“true” type=“link” count=“true” start=”*” /></code>

Would it have anything to do with being of the “link” type?

Also, a feature request. 1.) I would like is to be able to only list categories that have content in them. 2.)I would like to be able to have the count show the number of the content in the category and all sub-categories. (for link categories in this instance)

Thanks for all your help. I love this plugin and I would be lost without it.

Update: the problem with the count is with the type being set to something other than “article” it can be fixed with my hack, replace the last function “stw_get_live_count” with the following code:

<pre><code>
function stw_get_live_count ($cat) { if ($type=“link”) { $q = safe_count(“txp_link”,“category=’”.$cat.”’”); } else if ($type=“image”) { $q = safe_count(“txp_image”,“category=’”.$cat.”’”); } else { $q = safe_count(“textpattern”,”(category1=’”.$cat.”’ OR category2=’”.$cat.”’) AND status=‘4’”); } return $q;
}
</code></pre>

I believe I have also found a bug: While using sort=”*” everything works fine if I am in a category but if I am on my section list page /links/ with no category instead of just showing all the categories in a list I recieve the following error and no categories show up at all.

<code>Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in D:\dev\sites\cepa\public_html\textpattern\lib\txplib_db.php on line 209</code>

I don’t know how to fix it.

Last edited by tinyfly (2005-05-27 21:48:11)

Offline

#74 2005-06-02 19:32:20

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

Re: [Archived] stw_category_tree

I would like it if the count could also include all links/articles/images in subcategories as well. Is this possible?

Last edited by tinyfly (2005-06-02 19:33:12)

Offline

#75 2005-06-17 18:33:29

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

Re: [Archived] stw_category_tree

(bump) Any chance on getting the top level categories to show the count for links in subcategories and showing only the categories which have content in them. Right now it will show all categories no matter if they have content or not.

Last edited by tinyfly (2005-06-17 18:36:02)

Offline

#76 2005-06-27 09:39:06

winnehr
New Member
From: Vladivostok, Russia
Registered: 2005-02-05
Posts: 2
Website

Re: [Archived] stw_category_tree

> tinyfly wrote:

> Etz,
> You are awesome, it worked perfectly. Now one more request. Can you get mem_glinklist to output category titles instead of names, as well?

1. Replace
$name = stw_cat_link($name,$section) . ($count ? “ “.substr($count,0,1).stw_get_live_count($name).substr($count,1,1) : “”);
to
$name = stw_cat_link($name,$section,$title) . ($count ? “ “.substr($count,0,1).stw_get_live_count($name).substr($count,1,1) : “”);

2. In function stw_cat_link Replace
function stw_cat_link ($cat,$sec) {
to
function stw_cat_link ($cat,$sec,$tit) {

3. In function stw_cat_link Replace
return tag($cat,‘a’,’ href=”’.$path.‘c=’.urlencode($cat).’”’);
to
return tag($tit,‘a’,’ href=”’.$path.‘c=’.urlencode($cat).’”’);

Offline

#77 2005-06-27 14:28:43

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

Re: [Archived] stw_category_tree

That great winnehr, thanks. It removes the dependence on upm_category_title. So, php whiz can you also get my above requests, about the count and showing only categories with content, working?

I would greatly appreciate it.

Offline

#78 2005-06-28 03:25:13

winnehr
New Member
From: Vladivostok, Russia
Registered: 2005-02-05
Posts: 2
Website

Re: [Archived] stw_category_tree

> tinyfly wrote:

> That great winnehr, thanks. It removes the dependence on upm_category_title. So, php whiz can you also get my above requests, about the count and showing only categories with content, working?

Sorry, i haven’t time for your request. May be later.

Offline

#79 2005-07-16 18:39:59

santheo
Archived Plugin Author
From: Chicago
Registered: 2004-05-27
Posts: 62
Website

Re: [Archived] stw_category_tree

Whew! Finally carved out some time to bring the plug-in into the modern age. Among the improvements in version 0.6

Any news on using category titles instead of names

This is now in place. If a category row has anything in the title field, the plug-in will use that value as the category name.

Instead it takes me to:
http://cepa/links/?c=whatever-category notice the missing /main/
Any ideas on how to fix this?

I couldn’t test this, but it should be working now. If not, please let me know.

Update: the problem with the count is with the type being set to something other than “article” it can be fixed with my hack, replace the last function “stw_get_live_count” with the following code:

Thanks, tinyfly! I integrated your code into get_live_count, and added the support for file categories as well. I also added a credit for your help to the bottom of the help section.

Also, a feature request. 1.) I would like is to be able to only list categories that have content in them. 2.)I would like to be able to have the count show the number of the content in the category and all sub-categories. (for link categories in this instance)

  1. has been partially implemented. If you set <code>killempties</code> to true, it’ll only show categories that have articles (or links, etc.) associted with them. However, because of the nested nature of the plugin’s output, it can only kill categories that have no children. This results in some peculiar output, if you use nesting, but if you don’t, it can be a helpful feature.

I tried to work at #2, but it’s pretty difficult. It involves a level of recursion I’m not ready to get into yet. Hopefully I’ll be able to look into it eventually. (Though probalby not soon.)

I also had to update the way on classes were implemented. This probably won’t affect many people, but there was a bug wherein <code><ul></code> tags were getting the on class instead of <code><li></code> tags. If you upgrade, and you make use of this feature, be sure to test it out first to see if you need to update your CSS.

Please test out the new code and either email me or post a reply if you find any hinkiness — or if you generally have any questions.

Offline

#80 2005-08-01 20:34:59

jonhicks
Member
From: Oxfordshire UK
Registered: 2004-03-22
Posts: 256
Website

Re: [Archived] stw_category_tree

Hi Santheo,

I’ve just updated to 0.6 and RC5 on http://pimpmysafari.com. The tree shows, but the category count is 0 for each one. Is this a problem with RC5?


Cheers,
Jon VC#9

Offline

#81 2005-08-01 20:39:49

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

Re: [Archived] stw_category_tree

It looks like the links that this creates (at least for type article) uses the category title field for the url. It should use the category name field. The category title should be for display purposes only.

Offline

#82 2005-08-01 20:46:01

santheo
Archived Plugin Author
From: Chicago
Registered: 2004-05-27
Posts: 62
Website

Re: [Archived] stw_category_tree

jonhicks wrote:
I’ve just updated to 0.6 and RC5 on http://pimpmysafari.com. The tree shows, but the category count is 0 for each one. Is this a problem with RC5?

I’ve only tested with RC3, so it’s possible there’s a conflict. I’ll take a look.

Offline

#83 2005-08-01 20:49:25

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

Re: [Archived] stw_category_tree

While you are at it, would it be possible to add the the ablility to have the count either inside the li or outside of it?

Offline

#84 2005-08-01 20:58:12

santheo
Archived Plugin Author
From: Chicago
Registered: 2004-05-27
Posts: 62
Website

Re: [Archived] stw_category_tree

tinyfly wrote:
It looks like the links that this creates (at least for type article) uses the category title field for the url. It should use the category name field. The category title should be for display purposes only.

Oh my, you’re absolutely right. Sorry about that. Will be fixed in an update (as soon as I figure out the count problem).

While you are at it, would it be possible to add the the ablility to have the count either inside the li or outside of it?

To put it out of the li would make the code invalid. Do you mean put it inside/outside the <code><a></code> tag?

Offline

Board footer

Powered by FluxBB