Textpattern Forum

You are not logged in. Register | Login | Help

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

santheo
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
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
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
From: California
Registered: 2004-02-23
Posts: 730
Website

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
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

Board footer

Powered by FluxBB