Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-11-08 10:21:52
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
Print out things if category list contains less than "n" articles?
Is it possible to count articles of chosen category list, and if the list is goining to be short, show some text?
Would be handy to offer some other reading for the user.
Offline
#2 2007-11-13 16:14:21
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
Re: Print out things if category list contains less than "n" articles?
Any ideas for this?
Offline
#3 2007-11-29 00:32:50
- kpip
- New Member
- Registered: 2007-11-28
- Posts: 1
Re: Print out things if category list contains less than "n" articles?
This counts the live articles from the current category1 and outputs the text if there are less than 5
<txp:php>
$category = category1 (array ());
$q = "SELECT COUNT(*) count FROM ".PFX."textpattern WHERE (category1='$category') AND status='4'";
$rs = getRows($q);
$articlecount = ($rs[0]['count']);
echo ($articlecount < 5) ? 'There are less than 5 articles in this category' : '';
</txp:php>
I was trying to do this and ended up picking through mdn_count – hope it might be helpful
Offline
#4 2007-11-29 09:36:06
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
Re: Print out things if category list contains less than "n" articles?
Hiaa! Thanks!
Offline