Update of /cvsroot/php-blog/jBlog
In directory sc8-pr-cvs1:/tmp/cvs-serv26505
Modified Files:
jBlog_admin_entries.inc.php
Log Message:
this works better. The problem is that $half needs to be an integer
Index: jBlog_admin_entries.inc.php
===================================================================
RCS file: /cvsroot/php-blog/jBlog/jBlog_admin_entries.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- jBlog_admin_entries.inc.php 4 Mar 2003 23:11:42 -0000 1.3
+++ jBlog_admin_entries.inc.php 5 Mar 2003 04:22:13 -0000 1.4
@@ -24,7 +24,7 @@
// Prepare table
echo "<b>".ucfirst($action).":</b><br><table width='100%'>";
- $half = count($entries)/2;
+ $half = (int) ((count($entries) + 1)/2);
// Print the browse buttons
echo "<tr><td align='left'>";
@@ -36,22 +36,20 @@
echo '<input type="button" value=">>>" onClick="location.href=\'?jBlog[adminModule]=entries&jBlog[adminAction]='.$jBlog["GET"]["adminAction"].'&jBlog[offset]='.($jBlog["GET"]["offset"]+$perPage).'\';">';
}
echo "</td></tr>";
- $displayed = array();
// Print the entries
+ $count = count($entries);
for ($x=0; $x<$half; $x++) {
?>
<tr>
<td>
- <?php if (!isset($displayed[$x])) { $displayed[$x] = 1; ?>
<?= date("d.m.y, H:i", $entries[$x]["timestamp"]).": " ?>
<br><a href='?jBlog[action]=admin&jBlog[adminModule]=entries&jBlog[adminAction]=<?= $action ?>&jBlog[id]=<?= $entries[$x]["id"] ?>'>
<?= htmlentities(substr($entries[$x]["title"],0,40)) ?></a>
</a>
- <?php } ?>
</td>
<td><?= str_repeat(" ", 7)?></td>
<td>
- <?php if (!isset($displayed[$x + $half])) { $displayed[$x + $half] = 1; ?>
+ <?php if ($x + $half < $count) { ?>
<?= date("d.m.y, H:i", $entries[$x+$half]["timestamp"]).": "?>
<br><a href='?jBlog[action]=admin&jBlog[adminModule]=entries&jBlog[adminAction]=<?= $action ?>&jBlog[id]=<?= $entries[$x+$half]["id"] ?>'>
<?= htmlentities(substr($entries[$x+$half]["title"],0,40)) ?></a>
|