You are not logged in.
> 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
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
> 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
> 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
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
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
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
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