Page 1 of 1

Guestbook questions

Posted: Wed Apr 21, 2004 7:51 am
by Kon-Tiki
At the moment, my guestbook looks like this. It's looking great already, but I'm missing a couple more things. I want to have two drop-down menu's, one for changing the font's size and one for changing the font's color. I can easily make those, but I don't know how to get its value passed on to the comment-part, like with the smilies or other tags.

Second thing is that I want to limit the amount of entries on a page. Say after 15 entries, it puts the next in a new page, preferably while the input fields stay above it. I was thinking of adding a mark above each entry and have it check them, a variable counting up to 15 and if it reached that, switch to a new page. Two problems arise here though. One is that I've got to avoid people adding that mark, or it'd mess the guestbook up, the other is that I don't know how to code it. From all the help you guys can give, I appreciate pushing in the right direction most and just giving the code for it the least, as this is still for me to train in php, and copy-paste doesn't get me to learn and understand as well as finding the code myself, even if I've been given alot of hints as to how to do it.

Re:Guestbook questions

Posted: Wed Apr 21, 2004 10:26 am
by Eero Ränik
Pushing you to the right direction: http://www.php.net/manual/nl/ ::)
First question: http://www.php.net/manual/en/language.v ... ternal.php
Second question:
Scrap include();.
Scrap all the \n-s in fwrite();.
Insert one \n in the end of the line, so each post is saved into the text file as one line
Use file(); to read the file as an array, each element ending with \n (that's why you removed them before).
Use count(); to count all the elements in the array.
Now you should know what to do next.
Good luck! :D

Re:Guestbook questions

Posted: Thu Apr 29, 2004 8:43 am
by Kon-Tiki
Guestbook is finished. Now all there needs to be done, is optimizing the code so it runs quicker. Problem is that I don't have any idea or experience how to go about such a thing ::)
Anyway, code is here