|
|
Bug and Fix in "brief" topics
|
|
|
|
Posted under General by mochaexpress on Tuesday February 06 2001 @ 02:31AM EST
in ./include/blocks.inc.php
look in the section where it's doing the "topics block":
---cut--
# topics block
if ($CONF["Topics"]>0 && $align==$aln) {
$VAR["Heading"] = _TOPICS;
$VAR["Content"] = "";
$sql = "SELECT * FROM T_Topics";
if ($CONF["TopicSort"]=="asc") {
$sql .= " ORDER BY Topic ASC";
} elseif ($CONF["TopicSort"]=="desc") {
$sql .= " ORDER BY Topic DESC";
}
$topics_result = @mysql_query($sql,$db);
$topics_nrows = @mysql_num_rows($topics_result);
if ($CONF["TopicSort"]=="brief") {
$numtops = $topics_nrows;
$topics_nrows = 5;
}
---cut---
the tests for brief will fail if you have less than 5 topics with a db error when it encounters F_Count() later in the for loop. for example, if you have only 4 topics, the for loop will keep going 'til it reaches 5. at which point it will fail at the F_Count() function cause there is no 5th record.
here is the fix:
---cut---
if ($CONF["TopicSort"]=="brief") {
$numtops = $topics_nrows;
if ($topics_nrows > 4) {
$topics_nrows = 5;
}
}
---cut---
this parameter should technically be a user set number. sorry my copy is extremely modified to provide a proper diff. ;-(
|
jason writes on Tuesday February 06 2001 @ 11:41AM EST: [ reply | parent ]
Thanks!
|
|
|
|