Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Help & Support specify number of news items per catagory
Andyb
Posted on 23 Jan 2010, 20:11:47

Access: Member
Total Posts: 18
Joined: 2008-05-16

Hi Chris,

I am looking to specify the amount of news to show per category and came accross this post which goes some way to what I want, but seems to apply to all news rather than by category.

Please can you point me in the right direction regarding code:

I have static pages where I would like one news item in a category (say about_us) and others where I would like to specify four or five news items per page (say a blog page).

AndyB
#1728
Chris
Posted on 24 Jan 2010, 09:03:29

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

The reason this isn't possible with system is that there simply is no easy way to do it. The way the system works at the moment is first grabs all the variables you specify before an include, authors, categories ect. It then forms these into 1 single query string that looks something like this

Code:
SELECT fields FROM newstable 
join categorytable
join usertable
WHERE 
cats IN [1,2,3,4,5]
AND
authors IN [1,2,3,4,5]
ORDER BY posted LIMIT 0, 10


The LIMIT is at the end of the query which only allows you to limit the total results to a certain amount.

The only way to do what you want would be to use multiple queries then join the results possibly using UNION but like before, there currently is no easy way of doing this.
#1732
Network-13.com © 2013