Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#157 2006-04-04 21:20:43

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

Re: [Archived] stw_category_tree

Awesome. sortdir would be nice also. Sometimes I would like to list the categories in descending order instead of ascending.

Last edited by tinyfly (2006-04-04 21:21:05)

Offline

#158 2006-04-06 01:42:40

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

Re: [Archived] stw_category_tree

Santheo, can you tell us what stw_get_lineage and stw_get_ancestor [and others] are, what they do, and how do use them? They seem like the would be useful but for the life of me I can’t figure out what they do.

Last edited by tinyfly (2006-04-06 01:43:04)

Offline

#159 2006-04-23 03:02:10

sben
New Member
From: Seattle
Registered: 2004-02-23
Posts: 2
Website

Re: [Archived] stw_category_tree

Thanks much for this plugin.

A possible bug report: When displaying a list of categories, those which have subcategories get an extra carriage return before their link.

This probably shouldn’t be a problem, except that Safari 2.0.3 behaves slightly wonky in this situation, at least with the CSS I’m using (which puts a small dot and a space before <li> elements). Specifically, it seems to try to render the carriage return as a (horizontal) space, between my CSS’s dot-and-space and the content of the <a> element, or perhaps sometimes as an actual carriage return (I haven’t figured out exactly what it’s doing under all circumstances).

Firefox 1.5 is okay; I don’t remember for certain, but don’t think IE has a problem with it either (!).

Below is the exact stw_category_tree syntax, the possibly-relevant CSS, and the resulting HTML. Note the extra carriage return before the “c=Nathan” and “c=Plants” <a> elements. This comes from http://pile.org/photos/ (in the right sidebar). (The horizontal tabs seem to be lost here on this forum, but are available by viewing source on the page.)

<txp:stw_category_tree section="*" type="image" wraptag="ul" break="li" cssid="category_list" maxdepth="0" />

… with (possibly-relevant) CSS

ul.related_articles, ul.category_list, ul#category_list
{
	list-style-type: none;
	margin-top: 0px;
	padding-top: 0px;
	margin-left: 0px;
	padding-left: 0px;
}
/* This, along with the list-style: none above, will put a ⋅ (sdot, hex 22c5) and a nonbreaking space (nbsp, hex 00a0) before li content. */
ul.related_articles li:before, ul.category_list li:before, ul#category_list li:before
{
	content: "\22C5\00A0";
}

… results in …

<ul id="category_list">
	<li><a href="http://pile.org/photos/?c=Ben">Ben</a></li>
	<li><a href="http://pile.org/photos/?c=Cats">Cats</a></li>
	<li><a href="http://pile.org/photos/?c=Family">Family</a></li>
	<li><a href="http://pile.org/photos/?c=Meghan">Meghan</a></li>
	<li>
		<a href="http://pile.org/photos/?c=Nathan">Nathan</a>
		<ul>
		<li><a href="http://pile.org/photos/?c=Months-0-to-3">Months 0 to 3</a></li>
		<li><a href="http://pile.org/photos/?c=Months-3-to-6">Months 3 to 6</a></li>
	</ul>
	</li>
	<li>
		<a href="http://pile.org/photos/?c=Plants">Plants</a>
		<ul>
		<li><a href="http://pile.org/photos/?c=Eastlake-flowers">Eastlake flowers</a></li>
</ul>
</li>
</ul>

I’m using Textpattern 4.0.3. Other versions (PHP, etc.) available on request (I don’t have them at hand).

Offline

#160 2006-05-17 04:27:59

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

Re: [Archived] stw_category_tree

In the interest of bringing the plug-in into the modern age, I’ve torn it apart and rewritten it to run more efficiently. However, with as many features, and thus contingencies, as this plugin has, I didn’t feel I was able to give it as thorough of a testing as it needs. So I’m releasing the new version as a beta. If you have a few moments, please test and report your feedback here. I hope to have enough response within a week to remove the beta designation and release version 1.0 in confidence.

Download v1.0 beta here.

Version 1.0b shouldn’t change anything about your current setup, if you’re using version 0.7.1. However, as it is a beta, you should be careful to test this on a dev site or when you have few visitors. If you need to revert, the old version (0.7.1) of this plug-in is still availabe online.

Meanwhile, the new version has a few new features. Read on…

grad wrote:
I try to get a list of categories only for articles published in current section.

This feature is now in place. Set <code>localized</code> to “y”, and the only categories that will show up are ones that have articles active in the current section. (Or that are the parents of such categories.)

Anton wrote:
Is there any way I could make this plugin show the current category when viewing an individual article? In this case I guess the current category is not the value of the ?c= parameter but the value in the database entry for the selected article.

Alas, this is more difficult that I thought. Because the stw_category_tree tag is called from within a page, and not an article form, it doesn’t seem to “know” anything about the current article. If anyone has any advice on how to determine the current category, I’d be interested in hearing it.

Pat64 wrote:
I have any problems with my artcles, only with the count in stw_category_tree : it counts all articles past and fututre.

This is now fixed. Each article count is now, by default, only counting articles dated in the past. Set <code>time</code> to “future” or “all” to alter that.

tinyfly wrote:
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)

This was much easier than I expected. To turn on this feature, set <code>subtotal</code> to “y”.

tinyfly wrote:
Santheo, it would be great if you could include support for the wraptag and break attributes. So by default it would be an unordered list but this could be over-ridden by the aforementioned attributes.

Done. If <code>break</code> is set to “hr” or “br”, it’ll append the tag to the end of the link instead of surround it. If either is set to a space (” “), it’ll remove that tag entirely. It’s set to “ul” and “li” by default.

Offline

#161 2006-05-17 13:54:29

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

Re: [Archived] stw_category_tree

Great work Santheo. Thanks for all the changes. I will test it out shortly and get back to you.

Offline

#162 2006-05-17 17:25:26

robmcm
New Member
Registered: 2006-05-17
Posts: 8

Re: [Archived] stw_category_tree

This is superb but there is one thing I am desperate for. If I am using this for a site navigation and then again for a sub navigation (using prune and min level 2) but I need the pages to appear in a diffrent order (not alpahbetical)

Does anyone know a solution, perhaps output by published at order and then I can change the published times so they are in the order I want?

Thanks

Offline

#163 2006-07-02 15:14:09

chairman
New Member
Registered: 2006-07-02
Posts: 4

Re: [Archived] stw_category_tree

Guys, sorry for this. I’m new to Textpattern and just tried out this plugin. However when I installed it on the site I’m working on I get this error.

tag_error <txp:stw_category_tree wraptag=“ul” break=“li” section=“about” start=“about” /> -> Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource on line 264

Help please!!

Offline

#164 2006-07-02 16:05:13

chairman
New Member
Registered: 2006-07-02
Posts: 4

Re: [Archived] stw_category_tree

it seems that it’s the “start” attribute that’s causing the problem. I have a section called about and when i set the value of the “start” attribute to “about” it causes the error I mentioned above. I also can’t seem to get it to out put just the categories that are assigned in the about section.

Offline

#165 2006-07-02 16:07:28

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

Re: [Archived] stw_category_tree

chairman- Which version are you using?

Offline

#166 2006-07-02 16:10:47

chairman
New Member
Registered: 2006-07-02
Posts: 4

Re: [Archived] stw_category_tree

i tried both 1.0b and the 0.71. both of them don’t work. I’m not sure if it has something to do with the mysql version.

Offline

#167 2006-07-07 06:14:24

flowmom
Member
Registered: 2005-08-23
Posts: 15
Website

Re: [Archived] stw_category_tree

Hi,

This is such a useful plugin.

Probably a really dumb question but my searches and reading haven’t revealed the answer. I’m new to TXP and CSS and I’ve been working on a site for a while but I took a long break. I’ve been fiddling with it a lot and now my navigation doesn’t work the way that it used to. I want to display all main categories in the nav bar. When you click on one of the main categories, I’d like to display the main categories, with the subcategories of the current category displayed (nested). It used to work perfectly that way with the code:
<code>
<txp:stw_category_tree cssid=“navigation” prune=“true” onclass=”“ />
</code>

Now, however, when I click on a category it continues to show only the main categories, not the applicable subcategories. I don’t think I changed anything about the stw_category_tree tag, but I did update TXP and stw_category_tree and I fiddled a lot with the CSS. But I didn’t expect that to change the category navigation functionality…what am I missing here?

Thanks in advance for any help,
flowmom

Last edited by flowmom (2006-07-07 15:46:38)


new to TXP, CMS, CSS, PHP

Offline

#168 2006-07-09 21:33:14

flowmom
Member
Registered: 2005-08-23
Posts: 15
Website

Re: [Archived] stw_category_tree

bump


new to TXP, CMS, CSS, PHP

Offline

Board footer

Powered by FluxBB