DigiOz Guestbook Version 1.7 Beta 2 Released!

  • Anonymous
  • Visitor
  • Visitor
18 years 10 months ago #30 by Anonymous
Replied by Anonymous on topic DigiOz Guestbook Version 1.7 Beta 2 Released!
Here is a modified list.php that displays the page links at the top of the page as well as the bottom.

Also, the page number is displayed at both the top and bottom of the messages. - Norman

list.php
Code:
<?php include("header.inc"); $page = $_GET['page']; $order= $_GET['order']; if ($page == "") { $page = 1; } $fwd = $page - 1; $rwd = $page +1; // Setting the default values for number of records per page ------------------------- $perpage = 10; //$filename = "list.php"; // Reading in all the records, putting each guestbook entry in one Array Element ----- $filename = "list.txt"; $handle = fopen($filename, "r"); if (filesize($filename) == 0){ // mpg are there any entries to display print "There are currently no entries to display"; // mpg no inform user } else { $datain = fread($handle, filesize($filename)); fclose($handle); $out = explode("<!-- E -->", $datain); $outCount = count($out) - 1; $j = $outCount-1; if ($order == "desc") { for ($i=0; $i<=$outCount; $i++) { $lines[$j] = unserialize($out[$i]); $j = $j - 1; } } else { for ($i=0; $i<=$outCount; $i++) { $lines[$i] = unserialize($out[$i]); } } // Counting the total number of entries (lines) in the data text file ---------------- $result = count($lines); $count = $result-1; //echo $count."<br>"; // Caclulate how many pages there are ---------------------------------------- if ($count == 0) { $totalpages = 0; } else { $totalpages = intval(($count - 1) / $perpage) + 1; } $page = $totalpages - ($page - 1); $end = $count - (($totalpages - $page) * $perpage); $start = $end - ($perpage - 1); if ($start < 1) { $start = 1; } //$end = ($perpage * $page) - 1; //$start = $end - $perpage; if ($start < 0) { $start = 0; } // Start of top of page links --------- echo "<center>"; // Creating the Forward and Backward links ------------------------------------- if ($fwd > 0 && $rwd > 0 && $rwd<$totalpages+1) { echo "<a href=\"list.php?page=$fwd&order=$order\">&lt&lt"; echo "<a href=\"list.php?page=$rwd&order=$order\">&gt&gt<br>"; } else if ($fwd == 0) { echo "<a href=\"list.php?page=$rwd&order=$order\">&gt&gt<br>"; } else if ($rwd == 0) { echo "<br><a href=\"list.php?page=$fwd&order=$order\">&lt&lt"; } else if ($rwd == $totalpages+1) { echo "<a href=\"list.php?page=$fwd&order=$order\">&lt&lt<br>"; } for ($i = 1; $i<=$totalpages; $i++) { echo " [<a href=\"list.php?page=$i&order=$order\">$i] "; } echo "</center><br>"; // End of top of page links --------- // Add the page number at the top ------------------ $pagenumber = $i - $page; echo "<center>"; echo "<br>Page <b>$pagenumber</b>"; echo "</center><br>"; //for ($i = $end; $i>=($start-1); $i--) //for ($i = 0; $i<$outCount; $i++) //for ($i=$start-1; $i<$end; $i++) for ($i=$end-1; $i>$start-2; $i--) { //echo $i."<br>end-".$end."-start-".$start; echo "<table bgcolor=#DA8E7C bordercolor=#C0C0C0 border=1 width=500 cellspacing=0 cellpadding=10><tr><td>"; echo "<b>$listDatetxt: </b>"; $lines[$i]->showDate(); echo "<br><b>$listnametxt: </b>"; $lines[$i]->showFrom(); echo "<br><b>$listemailtxt: </b><a href=\"mailto:"; $lines[$i]->showEmail(); echo "\">"; $lines[$i]->showEmail(); echo "<br><br><b>$listMessagetxt: </b>"; $lines[$i]->showMessage(); echo "</td></tr></table><br>"; } // Add the page number at the bottom ------------------ echo "<center>"; echo "<br>Page <b>$pagenumber</b>"; echo "</center><br>"; echo "<center>"; // Creating the Forward and Backward links ------------------------------------- if ($fwd > 0 && $rwd > 0 && $rwd<$totalpages+1) { echo "<br><a href=\"list.php?page=$fwd&order=$order\">&lt&lt"; echo "<a href=\"list.php?page=$rwd&order=$order\">&gt&gt<br>"; } else if ($fwd == 0) { echo "<a href=\"list.php?page=$rwd&order=$order\">&gt&gt<br>"; } else if ($rwd == 0) { echo "<br><a href=\"list.php?page=$fwd&order=$order\">&lt&lt"; } else if ($rwd == $totalpages+1) { echo "<a href=\"list.php?page=$fwd&order=$order\">&lt&lt<br>"; } for ($i = 1; $i<=$totalpages; $i++) { echo " [<a href=\"list.php?page=$i&order=$order\">$i] "; } echo "</center>"; } // mpg end if include("footer.inc"); ?>

Please Log in or Create an account to join the conversation.

More
18 years 10 months ago #31 by Pete
Thank Norman. I will take a look at it and see if we can include this with the next version of guestbook.

DigiOz Webmaster
www.digioz.com

Please Log in or Create an account to join the conversation.

More
18 years 7 months ago #66 by Norman
I saw a problem with an emoticon some weeks ago but forgot about it. I currently maintain two DigiOz Guestbooks running with version 1.6. I checked the Demo version 1.7 on this website and the same issue exists.

Let me spell it out by showing you the issue 8) The emoticon just used should show up as cool. This causes a problem if you write something containing an 8 followed by a close round bracket. For example I have just used (£28) in a message written to a Guestbook. That is, £28 surrounded by round brackets. You end up with an opening bracket the UK pound sign, the digit two and then a cool emoticon. I got around this by editing the the list.txt (v1.6) and used square brackets. A proper fix is required. I propose using :cool: as a substitute for the digit 8 followed by a closing round bracket.

Thanks, Norman

Please Log in or Create an account to join the conversation.

More
18 years 7 months ago #67 by Norman
In the example just posted, I proposed a colon folowed by the word cool followed by another colon as a substitute for the cool emoticon. To my surprise it showed up as the cool emoticon in the BB. I will test this in the Demo (v1.7) and the v1.6 version to see what happens.

Norman

Please Log in or Create an account to join the conversation.

More
18 years 7 months ago #68 by Norman
OK, the result was a colon followed by the word cool followed by a colon.

I will modify my v1.6 code to remove the problem. Maybe you can add this to the v1.7 wish list and include a fix in the beta release 3 code.

Thanks.

Norman

Please Log in or Create an account to join the conversation.

More
18 years 7 months ago #69 by Norman
OK, I have modified functions.php and guestbook.php so that any reference to an emoticon that uses the digit 8 followed by a closing round bracket has been replaced by a colon followed by the word cool followed by another colon. That fixed it 8)

Note that this has only been done in v1.6 that I use.

I guess that this BB suffers from the same problem.

Norman

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds
Powered by Kunena Forum