Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2004-07-24 00:18:13

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

Re: [Archived] stw_category_tree

> What I’d like to know is if there is a way to control which categories get output
> based upon the section you are in? Specifically, I have categories that I would
> like to show up in one section, but not in another…
>
> One idea I had to accomplish this was to create a parent category that
> corresponded to each section, however, I couldn’t figure out a way to prevent
> the title of the parent category from displaying (as it is redundant with the
> section name)…

The best way to produce the output you desire is exactly through the idea you offer. This is the precise intention of the <code>start</code> attribute. Define a top-level category that corresponds with a particular section, and put all categories you’d like to see in that section under that top-level category. Then call the plug-in, define <code>start</code> to be the name of that top-level category, and you’ll see a hierarchical list of all categories beneath that category. (That top-level category won’t show up in the list.

> The nested unordered list for subcategories needs to be enclosed in a parent li
> tag in order for the html to validate in xhtml 1.0 strict. I was able to make the
> changes to the plugin to accomplish this, though I admit it is not very elegant.
> Let me know if you’d like me to send this to you.

I looked around, and I can’t figure out a situation when the nested [ul] isn’t enclosed in an [li]. Please do send me the updated code, but also please cite an example of where this is happening, along with how the tag is being called, so I can try to replicate it on my own.

Thanks!

Offline

#32 2004-07-24 01:01:30

tmacwrig
Archived Plugin Author
Registered: 2004-03-06
Posts: 204
Website

Re: [Archived] stw_category_tree

great plugin. thanks.

Offline

#33 2004-07-24 07:46:35

And
Member
From: London, UK
Registered: 2004-02-24
Posts: 10
Website

Re: [Archived] stw_category_tree

Thanks Santheo, that sorted it. I should have worked it out myself if only I had a brain (even half a brain would be helpful sometimes). :)

Andy

Offline

#34 2004-08-13 02:54:13

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: [Archived] stw_category_tree

Another little bug, about semantic: using the txp tag with no attribute whatsoever, it produce this:
<code>
<ul> <li><a href=”/textpattern_g119/?c=Humeur”>Humeur</a></li>

<li><a href=”/textpattern_g119/?c=Internet”>Internet</a></li> <li> <a href=”/textpattern_g119/?c=Jeux+de+r%C3%B4les”>Jeux de rôles</a> <ul> <li><a href=”/textpattern_g119/?c=Ambre”>Ambre</a></li> <li><a href=”/textpattern_g119/?c=D%26D”>D&D</a></li>
</ul>

</li>
</ul>
</code>

Wich is not good, it should close the li HTML tag before opening a new ul tag for the nested list.

Offline

#35 2004-08-13 22:03:38

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

Re: [Archived] stw_category_tree

> Wich is not good, it should close the li HTML tag before opening a new ul tag
> for the nested list.

I don’t believe it should. I tested the code you quoted with the W3C validator and with the exception of an unencoded ampersand, it checked out. I tried switching it around like you suggested, as in —

<code>
<ul>
<li><a href=”/textpattern_g119/?c=Humeur”>Humeur</a></li>
<li><a href=”/textpattern_g119/?c=Internet”>Internet</a></li>
<li><a href=”/textpattern_g119/?c=Jeux+de+r%C3%B4les”>Jeux de r&#244;les</a></li> <ul> <li><a href=”/textpattern_g119/?c=Ambre”>Ambre</a></li> <li><a href=”/textpattern_g119/?c=D%26D”>D&amp;D</a></li> </ul>
</ul>
</code>

and I got the following error:

<code>Line 18, column 4: document type does not allow element “ul” here; assuming missing “li” start-tag</code>

Semantically, the UL should exist within the LI.

Offline

#36 2004-08-18 11:34:47

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: [Archived] stw_category_tree

> santheo wrote:
> Semantically, the UL should exist within the LI.

I should learn to validate code before thinking about logic ^^

Mea culpa, mea maxima culpa.

Offline

#37 2004-09-27 21:05:13

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [Archived] stw_category_tree

Correct me if I’m wrong or misunderstanding the attribute tags already available, but shouldn’t

<code>$section = (empty($section)) ? “” : $section;<code>

be

<code>$section = (empty($section)) ? $GLOBALS[‘s’] : $section;</code>

That way, if you’re including the category list in a form that is replicated on all pages, including section pages, the category links will stay relative to the currently-viewed section.

Last edited by compooter (2004-09-27 21:06:14)

Offline

#38 2004-10-02 20:50:05

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: [Archived] stw_category_tree

Could someone post some example tags?

I would like to display only the catagories that are in the currently viewed section and can’t seem to get any functionality other than a complete tree list with subcatagories included.

Thanks
Jamie

Offline

#39 2004-10-05 16:59:05

wilshire
Plugin Author
From: Akron, Ohio
Registered: 2004-08-27
Posts: 656
Website

Re: [Archived] stw_category_tree

i seem to be having the same problem. i’ve done what compooter suggested in order to default the section to the current section and that works great. i expected to be able to do the same with the start tag but its not working.

what i’ve done is setup a parent category with the same name as my section. that category has several sub-categories. i’d like for each section to display a list of sub-categories that are in the parent category that matches the section name however this doesn’t seem to do the trick:
<code>
$start = (empty($start )) ? $GLOBALS[‘s’] : $start ;
</code>

any ideas? thanks for the help…

Offline

#40 2004-10-10 23:10:30

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

Re: [Archived] stw_category_tree

compooter wrote:
> Correct me if I’m wrong or misunderstanding the attribute tags already available,
> but shouldn’t

You are not wrong. The code and original post has been updated. Good catch.

wilshire wrote:
> what i’ve done is setup a parent category with the same name as my section.
> that category has several sub-categories. i’d like for each section to display a list
> of sub-categories that are in the parent category that matches the section name
> however this doesn’t seem to do the trick:

Wilshire, I’ve added a feature to the <code>start</code> attribute so you can hack the system this way. If you set <code>start</code> to be “*s”, the code will define <code>start</code> as the current section.

Similarly, now if you set <code>start</code> to “*”, the code will define <code>start</code> as the current category.

Last edited by santheo (2005-07-09 16:53:40)

Offline

#41 2004-10-10 23:24:44

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

Re: [Archived] stw_category_tree

soulship wrote:
> I would like to display only the catagories that are in the currently viewed section
> and can’t seem to get any functionality other than a complete tree list with
> subcatagories included.

Jamie-

I’m a little confused about your situation. Category and sections are not interrelated. So it isn’t really possible to say that categories are within a certain “section.” That said, if you’re doing what wilshire is doing, and defining your top-level categories to be the same as your section names, you can set the <code>start</code> attribute to “*s” in order to only display the categories beneath the category that’s defined as the current section. Does that make sense?

You can also set the <code>start</code> value to “*” to in order to only display the categories under the current cateogry.

Offline

#42 2004-11-15 03:28:37

arakune
Member
Registered: 2004-10-23
Posts: 13

Re: [Archived] stw_category_tree

I’m not certain if my question pertains specifically to category_tree, or more generally to the way TXP handles subcategories, but thought I’d ask here since I’m using the category_tree plugin. if this is the wrong place, let me know ;)

I’m using category_tree to display a particular branch of my category tree, and am wondering if its possible to have a parent category link to an index of all of its children categories.

For example, I have

Category 2
-subcategory 4
-subcategory 5

Clicking on -subcategory 4, obviously, presents an index page of the most recent posts in subcategory 4.

Clicking on Category 2, on the other hand, presents an index page of the most recent posts explicitly in Category 2. What I would like is for it to present an index of the most recent posts in Category 2, subcategory 4 and subcategory 5 (i.e., the entire tree beginning with Category 2).

Is this possible?

Last edited by arakune (2004-11-15 03:29:27)

Offline

#43 2004-11-29 23:55:35

dbulli
Member
Registered: 2004-11-22
Posts: 195
Website

Re: [Archived] stw_category_tree

Santheo I changed your plugin sligthly for my site to output “c/category” vs “?c=category” as textPattern seemed a little broken for not having this be a clean url.

Maybe a future version can have a parameter for clean=“true” to output something like that.

in action: nuff-respec.com/technology/c/php

Last edited by dbulli (2004-11-30 00:30:06)


nuff-respec ::: dannyb

Offline

#44 2004-12-16 15:32:16

leeopold
New Member
Registered: 2004-03-05
Posts: 3
Website

Re: [Archived] stw_category_tree

Is there a quick and easy way to get a count of the aricles in each category listed? I currently have:

<txp:stw_category_tree start="posts" prune="true" />

Which displays a nice list of categories that are children of “posts”.

Any way to get it to list it as such:

Books (1)
Surf (2)
Bored (5)
Observed (0)

Last edited by leeopold (2004-12-27 00:00:38)

Offline

#45 2004-12-24 23:44:55

alice_c
Plugin Author
From: Karlsruhe, Germany
Registered: 2004-07-03
Posts: 33

Re: [Archived] stw_category_tree

Wasn’t there an posibility to output the categories as selectbox, like <txp:popup />? I think I have seen this on a txp-site…

Offline

Board footer

Powered by FluxBB