sNews Forum

sNews 1.6 (previous version) => Programming => Topic started by: stephane on July 11, 2008, 03:47:52 pm

Title: Filtring Archives function
Post by: stephane on July 11, 2008, 03:47:52 pm
Hello,
Is there any possibility to show in function Archives only ONE category ?
For example if I have 3 categories like CATEGO A, CATEGO B, CATEGO C with some different articles in it.
When we display Archives link, I want to see only the articles of the CATEGO B, and nothing else.
Do you think is that possible ?

Thanks
Stéphane
Title: Re: Filtring Archives function
Post by: Joost on July 11, 2008, 04:59:20 pm
Here is a simple solution, but you will have to look for the category id (table categories) in the database.

In function archives(),  find the following line:

$query = "SELECT * FROM ".db('prefix')."articles WHERE position = 1 AND published = 1 ORDER BY date DESC";

replace it with the red, bold  (id) is the id, found in the database:

$query = "SELECT * FROM ".db('prefix')."articles WHERE category = (id)  AND position = 1 AND published = 1 ORDER BY date DESC";
Title: Re: Filtring Archives function
Post by: stephane on July 11, 2008, 07:02:05 pm
Yes... That is the good solution.

Thanks a lot Joost (karma +1  ;)

S.
Title: Re: Filtring Archives function
Post by: funlw65 on July 11, 2008, 07:25:21 pm
Another good solution
http://snewscms.com/forum/index.php?topic=5783.0
Title: Re: Filtring Archives function
Post by: Joost on July 11, 2008, 07:37:44 pm
Another good solution
http://snewscms.com/forum/index.php?topic=5783.0
That's a menu.