Commit Graph

59 Commits (d5fe0cfe2017241094a84e4c4fb6bfdf1928f8eb)

Author SHA1 Message Date
Dries Buytaert 8a7690af57 Wheep! Wheep! Major performance optimization for index.php: we reduced the
number of SQL on the mainpage with factor 10 and shortened the code with 4
lines.  There is only *one* optimized SQL query left, being:

$result = db_query("SELECT stories.*, COUNT(comments.sid) AS comments FROM
stories LEFT JOIN comments ON stories.sid = comments.sid WHERE
stories.status = 1 AND stories.time <= $date GROUP BY stories.sid ORDER BY
stories.sid DESC LIMIT $number");

 Note: we use a LEFT JOIN to retrieve the number of comments associated
       with each story.  By retrieving this data now, we elimate a *lot*
       of individual queries that would otherwise be required inside the
       while-loop.  If there is no matching record for the right table in
       the ON-part of the LEFT JOIN, a row with all columns set to NULL
       is used for the right table.  This is required, as not every story
       has a counterpart in the comments table (at a given time).
2000-06-21 11:03:54 +00:00
Dries Buytaert 76f305571c * Changed a few things to make development easier without breaking things
to the outside world.  It's a first step towards improving the submission
  queue.

* More important (to the theme babies): instead of passing individual
  parameters I'm considering to pass an object.
    $theme->abstract($story->aid, $story->informant, $story->time,
     stripslashes($story->subject), stripslashes($story->abstract),
     stripslashes($story->comments), $story->category, $story->department,
     $morelink);
  would become:
    $theme->abstract($story);
  What do you guys think about pushing this trough?  It would be much better
  and would give extra `power' to the themes.
2000-06-16 11:00:57 +00:00
Dries Buytaert 07118dbd48 * Improved calendar.class.php speed-wise: did some inline caching to make
rendering a calendar less expensive.
* Added a function displayCalendar($theme, $active_date) to functions.inc.
* Adjusted index.php so it would support URIs formated like
  "?date=$unix_timestamp".
* Integrated the calendar in my personal theme: themes/Dries/theme.class.
  If you want to include the calendar in your theme, check the code in my
  $theme->footer(): global $date and call displayCalendar($theme, $date).

Check the main page at http://beta.drop.org/ with theme 'Dries' to see it
yourself!
2000-06-03 11:39:07 +00:00
Kjartan Mannes 92a0d43be9 Hopefully this will not break anything *prays*
;)
2000-06-02 18:36:15 +00:00
Kjartan Mannes 61584ea057 Fixed a typo 2000-05-20 00:38:26 +00:00
Kjartan Mannes e6998fd322 Wheeeeee... I think I finally figured this out :P 2000-05-19 23:33:15 +00:00
Dries Buytaert 02d673dc5e Just testing (and bored too). 2000-05-19 11:24:43 +00:00
Kjartan Mannes c678127f72 I got bored *G* 2000-05-19 11:20:58 +00:00
Dries Buytaert 008612ad49 Imported sources 2000-05-18 19:51:59 +00:00