Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Question about # of articles displayed
Hi, I recently installed TXP on my site and I am apparently still confused about the nature of sections, categories, articles and forms.
What I would like to do is: display only the most recent article on the main blog page, display that one article when the title is clicked on, and display multiple results when clicking on categories or searches. As it stands right now, I can only ever get one article at a time to display.
My blog is at: http://www.alexburr.com/blog/
Any ideas or comments are much appreciated, thanks!
Offline
#2 2006-03-20 19:03:24
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Question about # of articles displayed
You’ll need some conditionals. I’ll assume for the moment that you have Textpattern installed in /blog/, so that is your homepage. An example:
<code>
<txp:if_section name=”“></code> (if we are in the default section)
<code><txp:if_category></code> (and if we are on a category list page)
<code><txp:article limit=“20” form=“blah” listform=“blahblah” />
<txp:else /></code> (if we are on the home page)
<code><txp:article limit=“1” />
</txp:if_category>
</txp:if_section>
</code>
If you are using the default page template only for the default section, you can leave the if_section part out. If you are using the default page template also for other sections, e.g. ‘article’, you can add a <txp:if_section name="article">some other article tag</txp:if_section>
part.
EDIT: <txp:if_search></txp:if_search>
is for similar use.
Last edited by els (2006-03-20 19:04:31)
Offline
Re: Question about # of articles displayed
Ah, that kind of makes sense. Yes, I do have Textpattern installed in /blog (I architected my site that way a long time ago and installed TXP later on).
But do I edit the ‘default’ page, the ‘article’ page, or the ‘archive’ page for this type of thing? I’m not really sure how the three relate to each other. Right now my ‘Default’ section uses page ‘default’ and my ‘article’ section uses page ‘article’, both of which are using the same code. Those are my only two sections. I also have an ‘archive’ page but I’m not sure where it’s used.
Offline
#4 2006-03-20 22:25:24
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Question about # of articles displayed
For this you edit the default page.
In your case section ‘article’ is set to use page ‘article’, meaning that the front page and category lists will use the default page, and individual articles will use page ‘article’. (Page ‘archive’ is not in use in the default TXP install I believe.)
You have a choice: either you can use a different page template for each section, or you can set all sections to use the default template, and then use the conditional if_section tags to determine what is displayed when a particular section is called.
Offline
Re: Question about # of articles displayed
Thank you so much for your help! Think I’m getting the hang of it now.
Offline
Pages: 1