Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-04-04 12:10:03

Dorian
New Member
Registered: 2006-04-11
Posts: 5

Dynamic navigation linking directly to latest article in specific cat

Hello community!
Maybe this has been answered somewhere before but I wasn’t able to find it, so maybe it hasn’t. I’d be very glad to hear some suggestions!

I would like to have a navigation that looks like so:

Section 1
Category 1
Category 2
Category 3
Category 4

Section 2
Category 1
Category 2

Now: the “Category” list items should link directly to the newest article in that particular category – the others (older ones) are moved to the archive by manually changing the section to “Archive”.

How do I best go about this? There is no txp tag to put out the url to the latest article in a given category, is there? Should I maybe use forms?
I hope you can help me!

thanks in advance,
dorian

PS. maybe it becomes clearer when you look at the site: http://www.diehintertuer.ch/ (it’s german, though)

Last edited by Dorian (2007-04-04 12:12:42)

Offline

#2 2007-04-04 14:10:16

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: Dynamic navigation linking directly to latest article in specific cat

Uhm… I think you should use forms and manually change the category name in article_custom tag.

<h3><txp:section name="section1" title="1" link="0" /></h3>
<ul><li><txp:article_custom category="Category 1" section="section1" form="first_article" limit="1" /></li>
<li><txp:article_custom category="Category 2" section="section1" form="first_article" limit="1" /></li>
<li><txp:article_custom category="Category 3" section="section1" form="first_article" limit="1" /></li>...</ul>

And the form first_article should look something like this:

<txp:permlink><txp:category link="0" title="1" /></txp:permlink>

I hope this work…

Z-

Offline

#3 2007-04-06 13:10:09

Dorian
New Member
Registered: 2006-04-11
Posts: 5

Re: Dynamic navigation linking directly to latest article in specific cat

thank you Zanza!!

Somehow <txp:category /> doesn’t work – nowhere on the page. I tried in on my other txp driven site and it didn’t work either. Textbook says it can be used “in any context”, what am I doing wrong..? I’ve researched but it seems no one has this problem.. :)

edit: oh, cool, Zanza you’re italian and an artist! I’m studying painting in firenze!

Last edited by Dorian (2007-04-06 13:13:06)

Offline

#4 2007-04-06 18:34:05

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: Dynamic navigation linking directly to latest article in specific cat

Uhm… actually, txp:category is meant to represent the current category: in our case, from the article_custom tag the article could have one, two or none category. The category isn’t set. So it probably isn’t the right tag.

Have you tried using txp:category1 instead? That limits you to use only cat1 for your articles, but if I correctly get your site-structure, this shouldn’t be a problem, as you’re trying to replicate a classic taxonomy: one article has one category only.

Let me know if that works.

PS: Well, to call me an “artist” is a little too much, but thanks! I just enjoy drawing. :) I’m from near Venice, but Firenze is a beautiful city. Great for your studying. Where are you from? I’m looking forward to see your paintings online! :)

Last edited by Zanza (2007-04-08 00:32:47)

Offline

#5 2007-04-06 19:34:06

Dorian
New Member
Registered: 2006-04-11
Posts: 5

Re: Dynamic navigation linking directly to latest article in specific cat

Ok, will try, thanks!
I mostly grew up in switzerland. I’m still in the drawing state, so no paintings yet but my stuff is here: www.dorian-iten.com!

edit:
I use two categories but it still works (category2 is what I need in this case)! It really works! Thank you so much!!
Does <txp:category /> not work because I’m using two categories?

Last edited by Dorian (2007-04-06 19:56:10)

Offline

#6 2007-04-06 21:11:14

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

Re: Dynamic navigation linking directly to latest article in specific cat

<txp:category /> displays the category that is currently being viewed, i.e. the one that is in the url, so it will only work when on a category list page.
<txp:category1 /> and <txp:category2 /> display the category (1 or 2) of an individual article.

Offline

#7 2007-04-12 16:26:00

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: Dynamic navigation linking directly to latest article in specific cat

Great artworks, Dorian! :)
And interesting links, too. Bye.

Z-

Offline

Board footer

Powered by FluxBB