Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#121 2005-10-04 21:52:49

grad
Member
From: Poznan, Poland
Registered: 2005-10-04
Posts: 24

Re: [Archived] stw_category_tree

</code>
I am new to TXP. I try to get a list of categories only for articles published in current section (4.0.1 r.888). But instead I get a list of all articles. The same happens when using bulit-in <code><txp:category_list /></code>. I use both in the page template. Is it the way it is meant to work or am I missing something?

In my examle a <code>section</code> contains 3 articles: 1 of <code>category 1</code>, 1 of <code>category 2</code>, and 1 with no category. I expected to get list of 2 categories: <code>category 1</code> and <code>category 2</code>.

Offline

#122 2005-10-04 22:13:55

grad
Member
From: Poznan, Poland
Registered: 2005-10-04
Posts: 24

Re: [Archived] stw_category_tree

bauhouse wrote:
> > kemie wrote:
> A little bump to ask if it is possible to get this working with clean urls, so my outputted list will point to /section/category instead of section/?c=category
˙
Try editing the plugin by replacing the function stw_cat_link with this:
<code>function stw_cat_link ($cat,$sec) { global $pfr,$url_mode; $path = $pfr.”?”; if (!empty($sec) && $sec != ‘default’) $path = ($url_mode==1) ? $pfr.$sec.”/” : $path.“s=”.$sec.”&amp;”; return tag($cat,‘a’,’ href=”’.$path.urlencode($cat).’”’);
}</code>
I’m not sure if this is the right way to go about it, but it appears to be working for me.

Is this replacement still working?

Offline

#123 2005-10-10 14:39:53

grad
Member
From: Poznan, Poland
Registered: 2005-10-04
Posts: 24

Re: [Archived] stw_category_tree

Listing categories for current section only with <code>section=”*s”</code> seems not to work. I’ve tried this with rev. 888 but it didn’t work. Upgraded TXP to latest SVN (rev. 1011 at the moment) and got the same error

<code>tag_error <txp:stw_category_tree start=”*s” /> -> Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource.</code>

Also, I noticed that if a category name containes HTML entity (<code>&nbsp;</code> namely) it is displayed as code.

Offline

#124 2005-10-18 03:22:44

ss
Member
Registered: 2004-03-31
Posts: 20

Re: [Archived] stw_category_tree

> grad wrote:

> </code>
I am new to TXP. I try to get a list of categories only for articles published in current section (4.0.1 r.888). But instead I get a list of all articles. The same happens when using bulit-in <code><txp:category_list /></code>. I use both in the page template. Is it the way it is meant to work or am I missing something?

In my examle a <code>section</code> contains 3 articles: 1 of <code>category 1</code>, 1 of <code>category 2</code>, and 1 with no category. I expected to get list of 2 categories: <code>category 1</code> and <code>category 2</code>.

same problem. i would really like to work out how to only list categories from a certain section.

Offline

#125 2005-10-18 07:27:36

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: [Archived] stw_category_tree

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. I’m not fluent enough in PHP to do this myself..

Offline

#126 2005-10-18 07:45:24

grad
Member
From: Poznan, Poland
Registered: 2005-10-04
Posts: 24

Re: [Archived] stw_category_tree

@ss

In the meantime I found cbs_category_list plugin which displays only those categories which contain articles in the current section. You might want to try it.

Offline

#127 2005-10-18 08:49:47

ss
Member
Registered: 2004-03-31
Posts: 20

Re: [Archived] stw_category_tree

thanks very much, grad. i’m going to try it out :-)

Offline

#128 2005-10-18 12:56:36

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

Re: [Archived] stw_category_tree

anton – does the prune attribute work for you. In the help file it seems like this is what it should do.

Offline

#129 2005-10-18 13:04:24

Anton
Plugin Author
From: Alingsås, Sweden
Registered: 2004-11-16
Posts: 138
Website

Re: [Archived] stw_category_tree

tinyfly: pruning ok. my problem is not that the list disappears/prunes away (when viewing an individual article), but that the “active” status disappears from it. hope that helps.

Offline

#130 2005-10-18 13:08:11

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

Re: [Archived] stw_category_tree

Ahh I see, I’m afraid I can not help you there. I think that would take some tweaking of the php and I am not to skilled in that.

Offline

#131 2005-11-03 22:29:51

fpradignac
Plugin Author
From: France near Cognac
Registered: 2005-01-29
Posts: 359
Website

Re: [Archived] stw_category_tree

Well great plugin for me too !!!

I’ve hacked your code to output a <code>&amp ;</code> instead of your <code>&</code> in your stw_cat_link function :
<code>

? $path.“s=”.urlencode($sec).”&amp ;”//fpradignac

</code>

(without the space between “p” and “;” )

Last edited by fpradignac (2005-11-03 22:33:17)


françois

Offline

Board footer

Powered by FluxBB