Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-01-10 17:33:36

progre55
Member
Registered: 2006-05-02
Posts: 668

Category Navigation

For some reason, I am having diffiuclty figuring this one out …

I have a horizontal navigation bar. One of the items on the bar triggers a drop down. The dropdown list is populated by specific category titles chosen by me. All that is fine. The difficulty that I am having is how do I code it so that when of the category headings are selected it goes to a page showing the most recent article for that category.

Seems straight forward, but for whatever reason I am misisng something on how to get this achieved —

Any and all assistance is appreciated.

progre55

Offline

#2 2013-01-10 18:15:12

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Category Navigation

Each link of categories is so that: www.yoursite/index.php?c=category

If your page with <txp:article /> is in a section page you must include section name into a link: www.yoursite/index.php?c=category&s=section

Offline

#3 2013-01-10 18:22:45

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

Re: Category Navigation

progre55 wrote:

it goes to a page showing the most recent article for that category.

If you are looking for the code you need to show the article on that page, something like this should be enough:

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

Offline

#4 2013-01-10 22:38:24

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: Category Navigation

I am sorry but I was not clear enough —

I know the code to show the article — what I am struggling with is what the links should look like —

As an example if the navigation was colors and the dropdown had blue — what would this look like <a href=“url”>Blue</a> — so that when it got to the page it knew to pull up the most recent article that had Blue as its category —-

Hope this helps explain it more —-

Thanks.

progre55

Last edited by progre55 (2013-01-10 22:38:55)

Offline

#5 2013-01-11 07:16:06

MarcoK
Plugin Author
From: Como
Registered: 2006-10-17
Posts: 248
Website

Re: Category Navigation

The link would like this:
<a href=“www.yoursite.com/?c=blu”>Blue</a>

Offline

#6 2013-01-11 13:42:56

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: Category Navigation

Marco:

Thank you. Worked like a charm. Not sure why this one was sucjh a head scratcher for me.

progre55

Offline

Board footer

Powered by FluxBB