Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#25 2004-07-06 21:41:50
- Rufnex
- Archived Plugin Author
- From: Germany, Munich (Bavaria)
- Registered: 2004-06-23
- Posts: 51
Re: [Archived] stw_category_tree
santheo .. i will set up one .. for test i use a local server .. call you back here ;o)
Offline
Re: [Archived] stw_category_tree
First off, I’d really like to say thanks Santheo for creating this plug-in. Like a lot of others, I assume, I am currently using textpattern to set up a small web site as opposed to a blog. I have found this plug-in extremely helpful.
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)…
Any help would be appreciated!
Also, regarding the output of your plugin…
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.
Cheers!
Offline
Re: [Archived] stw_category_tree
Great plugin Santheo, I think it’s just what I’ve been looking for to help me sort out my categories.
The only problem is that I can’t get it to assign ID or Class attributes to the lists. I’m using the tag like this while I’m still testing:
<code>
<txp:stw_category_tree prune=true css_id=“catlist” />
</code>
But it doesn’t assign the ID to the UL tag.
Am I doing something wrong?
Offline
Re: [Archived] stw_category_tree
And,
I’ve been having the same problem with that as well and haven’t found a direct solution. To me it seems like a bug in the plugin. If you enclose the ul tag in a parent div, you can use inheritance in css to accommodate most of the styling if that is what you need the the id/class for.
Hope that helps…
Offline
Re: [Archived] stw_category_tree
Thenks elemental, I did find a way around it (sort of) by entering the required ID’s directly into the script:
<code>
$css_id = (empty($cssid)) ? “catlist” : $cssid;
$css_on_class = (empty($onclass)) ? “subcat” : $onclass;
$minlevel = (empty($minlevel)) ? 1 : $minlevel;
$maxlevel = (empty($maxlevel)) ? -1 : $maxlevel;
$section = (empty($section)) ? “” : $section;
$start = (empty($start)) ? “root” : $start;
$prune = (empty($prune)) ? false : $prune;
</code>
If that makes sense. :)
Last edited by And (2004-07-21 08:58:23)
Offline
Re: [Archived] stw_category_tree
> The only problem is that I can’t get it to assign ID
> or Class attributes to the lists.
This was indeed a bug in the code. Rather, in the documentation. Instead of calling the attribute <code>css_id</code>, remove the underscore, thus making the example you cite above read as such:
<code><txp:stw_category_tree prune=true cssid=“catlist” /></code>
I’ve uploaded a proper version, and will update the original post so the documentation reads right. (Note that the css_on_class property also was misnamed.) Sorry ‘bout that.
Offline
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
Re: [Archived] stw_category_tree
great plugin. thanks.
Offline
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
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
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ôles</a></li>
<ul>
<li><a href=”/textpattern_g119/?c=Ambre”>Ambre</a></li>
<li><a href=”/textpattern_g119/?c=D%26D”>D&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
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