Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-01-17 19:27:36

dimfish
Member
Registered: 2006-06-01
Posts: 72

3rd level nav with category/article lists

Apologies if I keep asking the same question in different ways and in different forums, but I am really struggling with my site now and am desperate to try and get this how I’d like. I haven’t been doing much to this site for some time, dipping in and out, and consequently haven’t really risen up the TXP learning curve very far!

Anyway…Could anyone help me with this?
I want to achieve a 3rd level navigation in my sidebar so that when you land on a section page, in the sidebar there is a list of categories for posts in that section (which I currently have fine with cbs_category_list)….but also I would like to have it so that when the user clicks on category, the first article in that category is displayed (in main content area), and also the sidebar menu changes so that there is now a nested list of all other articles in that cat positioned underneath the same category…with the other categories just staying listed as before. Does that make sense?

I just really need someone to give me a hand…tell me if it is possible with the txp core functions and point me in the right direction, or if I can combine some plugins to do this then please point me to those.

All help very gratefully received.

Offline

#2 2007-01-17 20:10:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: 3rd level nav with category/article lists

dimfish wrote:

….but also I would like to have it so that when the user clicks on category, the first article in that category is displayed (in main content area)

That one is not difficult, on the page (in the main content area):

<txp:if_category>
<txp:article limit="1" />
</txp:if_category>

You’ll have to look at the sort order to display the right article.

and also the sidebar menu changes so that there is now a nested list of all other articles in that cat positioned underneath the same category…with the other categories just staying listed as before.

I doubt if you can do this with this plugin (though I don’t know it) or any other category listing plugin, because usually they just list categories, and it’s not possible to insert an article list inside it. But as I’m not familiar with most of these plugins I’m not completely sure about that, you’d have to look at the available plugins and ask there.
What I would do, if you don’t have more categories than this (6?), is handcoding the menu.

<ul>
   <li><txp:category name="introduction" title="1" link="1" thissection="1" /></li>
   <li><txp:category name="why-are-we-here" title="1" link="1" thissection="1" />
      <txp:if_category name="why-are-we-here">
      <ul><txp:article listform="..." limit="..." /></ul>
      </txp:if_category></li>
   <li><txp:category name="who-are-we-helping" title="1" link="1" thissection="1" />
      <txp:if_category name="who-are-we-helping">
      <ul><txp:article listform="..." limit="..." /></ul>
      </txp:if_category></li>
   etcetera...
</ul>

If you’re using the same page template for more than one section (and the categories in those sections are not always the same), you can wrap this code in <txp:if_section> tags and repeat and adapt it for every section.

Last edited by els (2007-01-17 20:13:16)

Offline

#3 2007-01-17 20:49:41

anoke
Archived Plugin Author
Registered: 2006-04-15
Posts: 152

Re: 3rd level nav with category/article lists

edit: Els is the fastest.

I’m puzzled by the same thing. Creating such navigation is possible, but I haven’t found an effortless way yet. I tried something like the following, but the amount of hardcoding overwhelmed and I chose a different navigation..

<txp:if_article_list>

<h3> Cats!!! </h3>
	<txp:if_category name="cats">
	<txp:article form="subnavi"/>
	</txp:if_category>

<h3> Dogs!!! </h3>
	<txp:if_category name="dogs">
	<txp:article form="subnavi"/>
	</txp:if_category>

</txp:if_article_list>

(I have separate page handler forms for each section so i have only <txp:if_section name="foo"><txp:output_form form="page_handler_foo" /></txp:if_section> in page template)

Remember you have to use <txp:if_article_category> in article context. See

Last edited by anoke (2007-01-17 20:50:52)


- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -

Offline

#4 2007-01-17 21:45:45

dimfish
Member
Registered: 2006-06-01
Posts: 72

Re: 3rd level nav with category/article lists

Thank you Els and Anoke.
Yes, I though it would somehow be easier than doing this hardcording. However, am giving Els method a try and will report back in a while.
Thanks.

Offline

#5 2007-01-17 23:34:44

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: 3rd level nav with category/article lists

Check out stw_category_tree which writes nested categories into lists… may or may not help.

Offline

Board footer

Powered by FluxBB