Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-07-07 15:15:02
- alan
- Member
- From: earth
- Registered: 2006-04-20
- Posts: 14
How do I construct individual category pages?
Can anyone tell me how to go about constructing individual category pages? I see this everywhere on archive pages where category list items link to pages that contain the category heading and posts relative to the category. I figure there’s a way to do this without creating individual sections for each category.
Thanks, Alan
Offline
Re: How do I construct individual category pages?
By default a category article list will use the default page template to render so in that template use something similar to:-
<txp:if_category>
<h3 class="whatever">Category - <txp:category title="1" /></h3>
<txp:article form="formName" limit="4"
</txp:if_category>
There are also links to a number of threads relating to this which you might want to read.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#3 2007-07-07 17:00:46
- alan
- Member
- From: earth
- Registered: 2006-04-20
- Posts: 14
Re: How do I construct individual category pages?
Thank you, works exactly as described. Appreciate the link, too.
Alan
Offline
#4 2009-05-05 03:20:17
- christina.helen
- Member
- From: California
- Registered: 2009-03-20
- Posts: 38
Re: How do I construct individual category pages?
I am trying to do exactly what Alan asked – to make a category page that lists all the articles in that category. I’m using Stuart’s code except with a listform and having no luck with having my articles show up. So far I have
<div id="content">
<txp:if_category><h3>Category: <span id="orange"><txp:category title="1" /></span></h3>
<txp:article listform="category_archive" limit="10" />
</txp:if_category>
</div>
The title is changing appropriately when I select different categories in the sidebar (here) but no articles show up. Thanks for any help.
Offline
#5 2009-05-05 17:25:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I construct individual category pages?
First, change your category names to all lowercase, capitals in category and section names are not recommended. If that doesn’t help, can you post a tag trace of a category page?
BTW you don’t need listform
, if you use form
and don’t specify a listform the form will be used for article lists as well.
Offline
#6 2009-05-05 17:42:43
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I construct individual category pages?
Ah, I just noticed that your articles must be in section blog, not in section(?) categories. If that’s the case, you can’t use <txp:article />
but you need <txp:article_custom />
:
<txp:article_custom section="blog" category='<txp:category />' form="category_archive" limit="10" />
Offline
#7 2009-05-05 19:49:04
- christina.helen
- Member
- From: California
- Registered: 2009-03-20
- Posts: 38
Re: How do I construct individual category pages?
I changed the category names to lowercase (and changed listform to just form) but what really helped was changing to article_custom. Yes, I had the articles in blog. Now the articles are showing up great. I am seeing an error, though, that says Tag error: -> Textpattern Notice: Page template categories_test does not contain a txp:article tag on line 504
. How do I know where line 504 is and can you tell what is causing it?
Last edited by christina.helen (2009-05-06 01:13:49)
Offline
#8 2009-05-05 21:30:37
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I construct individual category pages?
Never mind the notice. If you set production status to ‘live’ it will go away. If you really want to get rid of it, add <txp:article pgonly="1" limit="1" />
somewhere between the if_category tags.
Offline
#9 2009-05-06 01:16:06
- christina.helen
- Member
- From: California
- Registered: 2009-03-20
- Posts: 38
Re: How do I construct individual category pages?
Oh, okay! Thanks, Els, the code is gone now.
Offline