index.php 696 Bytes
Newer Older
Dries's avatar
 
Dries committed
1
<?php
Dries's avatar
Dries committed
2

3
include_once "includes/common.inc";
Dries's avatar
Dries committed
4

Dries's avatar
 
Dries committed
5
// Initialize/pre-process variables:
Dries's avatar
 
Dries committed
6
$number = ($user->nodes) ? $user->nodes : 10;
Dries's avatar
 
Dries committed
7
$date = ($date > 0) ? $date : time();
Dries's avatar
Dries committed
8

Dries's avatar
 
Dries committed
9
// Perform query:
Dries's avatar
 
Dries committed
10
$result = db_query("SELECT n.*, s.*, u.userid, COUNT(c.lid) AS comments FROM nodes n LEFT JOIN story s ON n.nid = s.node LEFT JOIN comments c ON n.nid = c.lid LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[posted]' AND n.type = 'story' ". ($section ? "AND s.section = '$section' " : "") ."AND n.timestamp <= $date GROUP BY n.nid ORDER BY n.timestamp DESC LIMIT $number");
Dries's avatar
Dries committed
11

Dries's avatar
 
Dries committed
12
// Display nodes:
Dries's avatar
 
Dries committed
13
$theme->header();
Dries's avatar
 
Dries committed
14
while ($story = db_fetch_object($result)) $theme->story($story);
Dries's avatar
Dries committed
15 16
$theme->footer();

Kjartan's avatar
 
Kjartan committed
17
?>