Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: Filtring Archives function  (Read 2253 times)

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Filtring Archives function
« 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
Logged

Joost

  • Guest
Re: Filtring Archives function
« Reply #1 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";
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: Filtring Archives function
« Reply #2 on: July 11, 2008, 07:02:05 pm »

Yes... That is the good solution.

Thanks a lot Joost (karma +1  ;)

S.
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Filtring Archives function
« Reply #3 on: July 11, 2008, 07:25:21 pm »

Logged

Joost

  • Guest
Re: Filtring Archives function
« Reply #4 on: July 11, 2008, 07:37:44 pm »

Logged