Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: [MOD] - In Progress - Featured Article Retrieval Function  (Read 2336 times)

John Melling

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
    • http://www.johnmelling.com
[MOD] - In Progress - Featured Article Retrieval Function
« on: May 29, 2007, 04:26:14 pm »

Essentially I was after a featured article mod to make websites such as http://www.robgoodlatte.com/ possible with sNews.

The other featured article mod in progress seems to be taking more of a list style method to displaying multiple articles rather then the latest (or whichever) article in the header at the top of the page. I think both are required. Integrating both may make a bloated mod IMO.

Anyway, take a look here: http://www.rightleftcentre.com/

It's running on the exact same database as http://www.johnmelling.com but has seperate snews.php and style.css files, as you will see if you click a link or two..

Theres more of a summary on the page too.

Comments, suggestions? :cool:
Logged

bramsyuur

  • Hero Member
  • *****
  • Karma: 23
  • Posts: 873
    • http://snews.vietbee.net
[MOD] - In Progress - Featured Article Retrieval Function
« Reply #1 on: May 29, 2007, 04:46:33 pm »

Looking good introspekt!
I want to see their code!  ;)
Only one thing, It's supposed to see the entire 'Featured Article' or only one part of it?
Logged
La comunidad sNews en tu idioma!
Comunidad sNews en Espaņol

John Melling

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
    • http://www.johnmelling.com
[MOD] - In Progress - Featured Article Retrieval Function
« Reply #2 on: May 29, 2007, 04:53:18 pm »

I'll show you the code tomorrow when I have more time to write up the install procedure, work in 5 hours can't sleep! but I have to try!

Essentially I've made it to show exactly the same as a center article (break works etc) but I guess options along those lines are up in the air :-)

Oh, and only one line of original snews code is modified (for now) and the database isn't altered in any way.
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
[MOD] - In Progress - Featured Article Retrieval Function
« Reply #3 on: May 29, 2007, 07:21:12 pm »

Looks good, introspekt! I like where you're going with this, but obviously I'd like to test it myself first... :lol:
Logged

John Melling

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
    • http://www.johnmelling.com
[MOD] - In Progress - Featured Article Retrieval Function
« Reply #4 on: May 29, 2007, 09:47:16 pm »

Language Variables to be placed in the language variables section:
Code: [Select]

// FARF: (Featured Article Retrieval Function) Modification
$l['ars_catno'] = '2'; // The category number of the category you want to use as the hidden category (look in db)
$l['fp_title'] = 'fp_title'; // The CSS id of the title of the first post
$l['fp_text'] = 'fp_text'; // The CSS id of the text of the first post
$l['fp_date'] = 'fp_date'; // The CSS id of the date of the first post
   // FARF End
Find (In Display Categories Section - hides the Featured Article category):
Code: [Select]
$query = "SELECT * FROM ".db('prefix')."categories WHERE published = 'YES' ORDER BY catorder ASC";Replace with:
Code: [Select]
// $query = "SELECT * FROM ".db('prefix')."categories WHERE published = 'YES' ORDER BY catorder ASC";
$query = "SELECT * FROM ".db('prefix')."categories WHERE published = 'YES' AND id != ".l('ars_catno')." ORDER BY catorder ASC"; // FARF EDIT
Place in functions (Mine is below Function Center):
Code: [Select]
// FARF: (Featured Article Retrieval Function) Modification

function feature_article() {
$ars_query = "SELECT title, text, date FROM ".db('prefix')."articles ORDER BY date DESC LIMIT 1";
clean($ars_query);
$result = mysql_db_query(db('dbname'), $ars_query) or die("Failed Query");
$ars_result = mysql_fetch_row($result);
echo "
    ";
        echo "$ars_result[0]
";
    echo "
    ";
        echo "$ars_result[1]
";
    echo "
    ";
        echo "$ars_result[2]
";
}

// FARF: END
That should be it, test on a virgin snews.php with backups!
I haven't tested it on a virgin snews.php so let me know how it goes :D
Logged