Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-24 15:40:15

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

1 Section, 2 Categories, List Articles?

No – this is not a movie title :)

I have one section which has 2 categories. I want to list the articles under the category labels as an article list.

Here is what I had to begin with which list my articles in the section, but not by category.

<txp:if_article_list>

<!— article list —>

<a href=”<txp:permlink />” title=”<txp:title />”><h2><txp:title /></h2></a><br />
<txp:if_excerpt>
<! — article excerpt — >
<p><txp:excerpt /></p>
<txp:else />
<! — no excerpt — >
</txp:if_excerpt>
<txp:excerpt />

</txp:else />

<!— full article —>

<h2><txp:title /></h2>
<p><txp:body /></p>

</txp:if_article_list>

This is how I’d like both article categories to display, but with category headers – so I looked at the following code:

<txp:category_list label=“International Students Courses” wraptag=“h1” />
<txp:if_category name=“International Students Courses”>
<txp:recent_articles label=“International Students Courses” limit=“25” break=“br” wraptag=“h2” category=“International Students Courses” />
</txp:if_category>
<txp:if_category name=“Australian Students Courses”>
<txp:recent_articles label=“Australian Students Courses” limit=“25” break=“br” wraptag=“h2” category=“Australian Students Courses” />
</txp:if_category>

But couldn’t work out how to do it.

I am trying to use one form for the category/article list and full article display.

I’m lost – first time with categories :(

Last edited by tye (2006-10-24 15:42:15)

Offline

#2 2006-10-25 01:14:30

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: 1 Section, 2 Categories, List Articles?

OK – I fixed this by using this on my page template:

<h1>heading1</h1>
<txp:article_custom keywords=“keyword1” form=“course” />

<h1>heading2</h1>
<txp:article_custom keywords=“keyword2” form=“course” />

Not sure if its this right way and I’m pretty sure I’ve read an article showing article lists displayed by category – but can’t seem to find it – if you do, please let me know.

Offline

#3 2006-12-05 23:42:38

utamu
Member
From: upstate NY, USA
Registered: 2006-12-05
Posts: 20

Re: 1 Section, 2 Categories, List Articles?

I want to do something similar as well – list articles by category within a particular section page, with the category labels being prominent. definitely turning out more difficult than i would’ve thought. My main content sections all have similar structure and reference a single template.

i’m trying to keep my site as dynamic as possible without hardcoding too many values into the xhtml, so i’m going to try working it out with txp global variables in php (using the current section variable). I’ve been spending a LOT of time looking for plugins that do exactly what i want to no avail. I know there’s a ton of helpful plugins, but maybe i’ll hone my skills in txp and php better by trying my own solutions first before spending so much time surfing for the best quick fix.

BUT if someone wants to help a newbie out, feel free! :)

Offline

#4 2006-12-06 08:43:47

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: 1 Section, 2 Categories, List Articles?

http://forum.textpattern.com/viewtopic.php?id=11843 might help.

Last edited by lee (2006-12-06 08:44:12)

Offline

Board footer

Powered by FluxBB