Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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.
Refresh Dallas and other Refreshing Cities.
Offline
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
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)
- 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
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
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.
Refresh Dallas and other Refreshing Cities.
Offline
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
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?
Refresh Dallas and other Refreshing Cities.
Offline
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
Re: [Archived] stw_category_tree
yea, that is what I mean.
Thanks for all your hard work on this, I would be lost without it.
Last edited by tinyfly (2005-08-01 21:00:27)
Refresh Dallas and other Refreshing Cities.
Offline
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?
This is in fact a problem with my code. It’s been fixed in version 0.6.1. I’ve tested it with RC5, and it should be good to. Let me know if you see any more problems.
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.
This is fixed now. Sorry about that.
While you are at it, would it be possible to add the the ablility to have the count either inside the [a] or outside of it?
I didn’t have time to do this in this quick fix, but I’ll add it to the list of features for the next version. Thanks for the suggestion, tinyfly.
Offline
Re: [Archived] stw_category_tree
I have a feature request.
I would like to be able to output a header text: like headtext=“this is the header” and a way to tell it what tag to use like: headwrap=“h3”.
Would this be possible?
Also could you give me an example of how to use the non-documented functions that you created like: stw_get_lineage, stw_get_ancestor, etc…? I can’t seem to figure it out from the code.
Last edited by tinyfly (2005-08-09 12:59:34)
Refresh Dallas and other Refreshing Cities.
Offline
Re: [Archived] stw_category_tree
Another feature request! :-)
It sure would be swell if each category had it’s own ID and an inner span so I could use image replacement.
(Or is this already possible and I’m just overlooking something? Seems quite simple to do.)
Last edited by dreamstormer (2005-08-09 11:23:04)
“The neighboring marshmallow factory fared no better, having been unable to absorb the incredible pressure wave.”
Offline
Re: [Archived] stw_category_tree
I modified the code to add the headtext feature above. It is treated as a string so it can take html also. Example: <code>headtext=”<h3>Sub-Categories</h3>”</code>
Around line 16 add this to the attributes list: <code> $headtext = (empty($headtext)) ? “” : $headtext;</code>
About line 57 change this line: <code>if ($out) return tag(“\n” . $out,‘ul’,($css_id ? ‘ id=”’.$css_id.’”’ : “”)).”\n”;</code>
To this: <code>if ($out) return $headtext . “\n” . tag(“\n” . $out,‘ul’,($css_id ? ‘ id=”’.$css_id.’”’ : “”)).”\n”;</code>
There are probably better ways to do this but this is my stab at it.
Refresh Dallas and other Refreshing Cities.
Offline
Re: [Archived] stw_category_tree
Thanks for putting that out there, tinyfly. I don’t think I want to add this to the plug-in, since I’m not sure it’d be helpful to the majority of users, and I want to avoid bloat as much as possible. (I mean, more bloat.) But with your easy hack, I’m glad it’s easily available to those who want it.
Offline