話題によって記事を日付順に表示する

提供: GeeklogJpWiki

情報提供 kino terayama

http://www.geeklog.jp/forum/viewtopic.php?showtopic=7654

index.phpを以下のようにハックすることで,話題の1ページあたりの記事数にマイナスの数値を設定することで,その話題だけ逆順に設定できます。

index.php 109行目あたり

修正前:

if ($topiclimit >= $_CONF['minnews']) {
    $maxstories = $topiclimit;
}

修正後:

if ($topiclimit > 0) {
   if ($topiclimit >= $_CONF['minnews']) {
       $maxstories = $topiclimit;
   }
} else {
    if ( (- $topiclimit) >= $_CONF['minnews']) {
        $maxstories = (- $topiclimit);
    }
}


199行目あたり

修正前:

$msql['mysql']="SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS day, "
. $userfields . ", t.topic, t.imageurl "
. "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, "
. "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND"
. $sql . "ORDER BY featured DESC, date DESC LIMIT $offset, $limit";

修正後:

$msql['mysql']="SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS day, "
. $userfields . ", t.topic, t.imageurl "
. "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, "
. "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND"
. $sql . "ORDER BY featured DESC, date DESC LIMIT $offset, $limit";

if ($topiclimit < 0) { 
$msql['mysql']="SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) AS day, "
. $userfields . ", t.topic, t.imageurl "
. "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, "
. "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND"
. $sql . "ORDER BY featured ASC, date ASC LIMIT $offset, $limit";
}
個人用ツール