Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
how to list from specified Categories latest 3 articles?
Hello all,
I am new to TXP. In the past I have tried to use ExpressionEngine but I simply could not get my head around it. Since 2 days that I have installed TXP locally I have managed to get 90% of our new site as I want. There is 1 problem only and I surely overlook a simple thing.
In our small company are 2 people working, my wife and I. She does her things and I do mine. I have set up a section for her and 1 for me, that works. I have made categories for both of us, also ok. Now the problem is this, at my page I like to show the past 3 projects of each of the categories that are assigned to me.
I can’t embed the image so unfortunately a link to our site (and no, site is not up to date :-)
http://www.carelse.com/images/txp%20question%20forum.png
Hope it is clear enough
Jeroen
Time to volunteer? Come and join us at a great project which is going to be opensource: https://www.caloom.com
Offline
#2 2010-04-14 06:28:22
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: how to list from specified Categories latest 3 articles?
Hi Jeroen,
Normally, if the articles should match a particular section and a particular category, you would do it like this:
<txp:article_custom section="person-a" category="photos" limit="3" />
but your mockup gives me the impression that the articles have to match both category 1 and 2. If that is the case, you may want to have a look at a plugin: smd_query.
Edit: BTW new members can’t post images, but as soon as you’ve reached your 10th post, your status will change from New Member to Member and the restrictions will be gone :)
Last edited by els (2010-04-14 06:30:19)
Offline
Re: how to list from specified Categories latest 3 articles?
Thanks Els,
It works. My mistake was that in the “page” I use <txp:article /> but should have used <txp:article_custom /> instead. I realized that when I saw your code :-D
I use in the “pages” the following code
…
<div class=“span-24 clearfix”>
<txp:article_custom section=“Jeroen” category=“web” form=“portfolio” listform=“portfolio_listing” limit=“3”/>
</div>
<div class=“span-24 clearfix”>
<txp:article_custom section=“Jeroen” category=“photography” form=“portfolio” listform=“portfolio_listing” limit=“3”/>
</div>
…
And in the form “portfolio_listing” this code:
<div class=“span-7 append-1”>
(form_portfolio_listing)
<txp:permlink> <txp:upm_article_image type=“thumbnail” limit=“1” class=“border”/></txp:permlink>
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<p class=“date_portfolio_listing”><txp:posted format=”%Y-%m-%d” /></p>
<txp:rss_auto_excerpt overrideexcerpt=“1” excerpt=“body” length=“150” striptags=“1” showlinkwithexcerpt=“1” />
(form_portfolio_listing)
</div>
Time to volunteer? Come and join us at a great project which is going to be opensource: https://www.caloom.com
Offline
#4 2010-04-14 17:13:37
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: how to list from specified Categories latest 3 articles?
JeroenC wrote:
My mistake was that in the “page” I use <txp:article /> but should have used <txp:article_custom /> instead.
Yes, <txp:article />
is context sensitive, meaning that it will only ever show what is requested (section or category listing, individual article, search results…). With <txp:article_custom />
you can display anything anywhere :)
Offline