Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-19 22:35:50

The Human Museum
Member
From: Toronto, Canada
Registered: 2005-11-21
Posts: 64
Website

Article Output In List Different Depending on Multiple Categories?

I’m neck deep in a redesign over at The Human Museum and since I’m still new to Textpattern I’ve been beating my head against the wall on a few design issues.

First if you navigate to the site you can see how I want the main page to look. Multiple recent article listings depending on the section (ie. “Long Hand, Visual, Short Hand, etc.). So far so good.

Now what I want to do is allow the viewer to navigate to a page that will output a list of say five articles ordered by the date, but outputting the same styles as I have on the main page depending on the category. For instance, if the post is from the “Long Hand” category I wish for it to be displayed like on the front page (Title, thumbnail, and excerpt). If the post is from the “Photoblog” category, I want it to be displayed like a thumbnail, just as it’s displayed on the front page. If it’s from the “short Hand” category, I want it to be displayed as an excerpt only. I want there to be a navigation area at the bottom of the list that will allow the user to navigate to the next 5 articles or the previous five articles.

Now I’ve come across a few posts involving having an article output with if/else statements – but that’s an either/or scenario and I want to include multiple styles.

Here was the article form code I was tinkering with…

<code><txp:if_category name=“Long Hand”>
<div class=“recentpost”>
<div class=“rssthumb”>
<h1><txp:permlink><txp:title /></txp:permlink></h1>
<h2><txp:permlink><txp:hak_article_thumb /></txp:permlink></h2>
<txp:kgr_safe_excerpt count=“100” linktext=”<div class=‘more’>Read More</div>” />
</div></div>
</txp:if_category>
<txp:else />
<txp:if_category name=“Photoblog”>
<div class=“rssthumb”>
<txp:permlink><txp:hak_article_thumb /></txp:permlink>
</div>
</txp:if_category>
<txp:else />
<txp:if_category name=“Short Hand”>
<txp:beginning length=“200” format=“inside” linktext=” …Read More” />
</txp:if_category>
</code>

But that doesn’t work

Once that’s figured out, how would I enable the user to navigate to that page from the index? Would I have to create a new section?

Last edited by The Human Museum (2006-01-19 22:36:49)


“I was born to hustle roses down the avenues of the dead.” – Charles Bukowski
The Human Museum

Offline

#2 2006-01-19 22:53:00

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Article Output In List Different Depending on Multiple Categories?

FAQ


Alex

Offline

#3 2006-01-19 22:56:37

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

Re: Article Output In List Different Depending on Multiple Categories?

If you just take out every txp:else, and use txp:if_article_category instead of txp:if_category, it should work.

Offline

#4 2006-01-19 23:05:19

The Human Museum
Member
From: Toronto, Canada
Registered: 2005-11-21
Posts: 64
Website

Re: Article Output In List Different Depending on Multiple Categories?

Thank you doggiez! It seems I was also tripped up by replacing the spaces in the category names with hyphens.

Cheers.


“I was born to hustle roses down the avenues of the dead.” – Charles Bukowski
The Human Museum

Offline

#5 2006-01-19 23:40:16

The Human Museum
Member
From: Toronto, Canada
Registered: 2005-11-21
Posts: 64
Website

Re: Article Output In List Different Depending on Multiple Categories?

Alright one more question. In order to make this work I made a section called “Browse” so that I could navigate there via http://thehumanmuseum.com/blog/browse/

I then put this navigation after the article list:

<code><txp:if_individual_article>
<p>
<txp:link_to_prev><txp:prev_title /></txp:link_to_prev>
<txp:link_to_next><txp:next_title /></txp:link_to_next>
</p>
</txp:if_individual_article>
<txp:if_article_list>
<p>
<txp:older>Previous</txp:older>
<txp:newer>Next</txp:newer>
</p>
</txp:if_article_list></code>

But i can’t seem to get navigation to work. Is it because it’s calling a section?


“I was born to hustle roses down the avenues of the dead.” – Charles Bukowski
The Human Museum

Offline

#6 2006-01-20 09:56:52

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

Re: Article Output In List Different Depending on Multiple Categories?

I think the first part of your code wouldn’t work, because once you are on an individual article page, you’re not in section ‘Browse’ anymore (and that is where the code is, I assume).

I don’t know why <txp:older> and <txp:newer> shouldn’t work though.

Offline

Board footer

Powered by FluxBB