100%
|
Post by Aaron on May 2, 2005 14:39:02 GMT -8
@ Uchiha Sasuke: I use this: $comment = htmlspecialchars($comment,ENT_QUOTES); Above my UBBC preg_replace and str_replace 's. .. but I don't know exactly what it does. I have a question for you, (hopefully you know), using count(), is there any way to make it count ever # of lines? Because the data in my text file goes something like this: <tr> <td></td><td></td> </tr> <tr> <td></td><td></td> </tr> That's like 6 lines. So when I use count() to count how many entries I've made, it counts ever line .. so if there is 5 entries, it will say there are 30 entries =/ Get what I mean? And I don't want to code it as one line like this: <tr><td></td><td></td></tr><tr><td></td><td></td></tr> Because that's not very clean HTML. So basically, I'm wondering if I can use some sort of function for it to count every 6 lines instead of every line, or something that will make it divide the count() by 6. Thanks if you can help.
@ CDDude: Here's what I use: echo "<div align=\"center\"> <table width=\"700\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"bordercolor\"> <tr> <td> <table width=\"100%\" cellpadding=\"3\" cellspacing=\"1\" border=\"0\"> <tr> <td width=\"100%\" align=\"center\" colspan=\"2\" class=\"topbg\"><b>Guestbook Entries</b></td> </tr> <tr> <td width=\"20%\" align=\"center\" class=\"topbg\"><b>User</b></td><td width=\"80%\" class=\"topbg\"><b>Comments</b></td> </tr> "; include("database/entries.txt"); echo "<tr> <td width=\"100%\" colspan=\"2\" class=\"topbg\"> </td> </tr> </table> </td> </tr> </table> </div>"; Basically, my data is sent to "entries.txt" as what I stated above to Uchiha Sasuke, then it displays it in order: Oldest to Newest. Any ideas?
Last Edit: May 2, 2005 14:42:23 GMT -8 by Aaron
|
|
|
Post by CD on May 2, 2005 15:42:54 GMT -8
I was going so suggest doing the HTML, like how I have mine coded.
Instead, do the function I said, except, you could store the info all in seperate files. Another way, would be to get count($data)/6 for the total. If what you want.
Is it possible to say something like ($x=0;$x<$n;$x+6)? If so, do that, and have it echo $data[$x+6] or -6, can't remember.
|
|
100%
|
Post by Aaron on May 2, 2005 15:48:39 GMT -8
So how am I supposed to display the stuff from newest to oldest?
|
|
|
Post by CD on May 2, 2005 15:59:44 GMT -8
I said if that for loop is possible, do that. *shrugs* easiest way would be to convert to one line, sorry to say, but that's true.
|
|
100%
|
Post by Aaron on May 2, 2005 17:03:50 GMT -8
I might convert to 1 line if I absolutely(sp?) must... I might have to if I can't get the total amount of entries =/
hmm .. maybe I could check out CuteNews's coding lol.
Anyway, I'll have to figure something out .. because these loops are confusing -_- ..
|
|
100%
|
Post by Aaron on May 7, 2005 13:05:03 GMT -8
I had to look at various codings to get mine right .. -_- .. but I finally got it.
The only major problem is the line breaks. If you use it, it will mess up the whole guestbook, so I had to censor it out to a normal space.
I know how to make the line breaks turn into "<br />" is just it's adding "\n" to the text file and messing it up .. oh well. Also, a problem with the lines breaks, is if you use them, it won't display the date .. -_- I'll try to fix it, or get some help.
Since I recoded it, I can finally display the total entries correctly. Before, I sent information like this to the text file:
<tr> <td>" . $name . "</td> <td>" . $date . "</td> </tr> <tr> <td>asdf</td> <td>asdf</td> </tr>
And that would count as 8 entries even though that is really 1. The reason is because count() counts the number of lines .. my only alternative would be to code the whole thing in one line, but that's not very "clean" coding. Now that's fixed =]
|
|
|
Post by CrAzY_J on May 7, 2005 13:22:05 GMT -8
so you got the preg replace and the other stuff to work?
|
|
100%
|
Post by Aaron on May 7, 2005 13:35:33 GMT -8
No, the links don't fully work yet, but that's the least of my concerns. I'm focused on getting line breaks to work.
|
|
100%
|
Post by Aaron on May 8, 2005 12:57:32 GMT -8
I finally fixed my line break problem! I also fixed the linking problem.
The version increased to 0.0.6.
I'm going to work on some other stuff for the guestbook, not sure what yet.
I'm thinking of removing the page load time and replacing it with the current time? What do you think?
Please check the place out and report any bugs you may find or give suggestions.
|
|
|
Post by CD on May 8, 2005 13:21:32 GMT -8
FAQ Page: Parse error: parse error, unexpected $ in /home/naruto/public_html/guestbook/index.php on line 261 I like the idea for making page laod into current time. Then you could comapre and see when previous messages were made. Edit: Nevermind FAQ, you fixed it. Edit2: Also, make it so it checks the link to be valid I got away with "blah"
Last Edit: May 8, 2005 13:23:41 GMT -8 by CD
|
|