HomePHP Page 7 - Building A Quick-And-Dirty Guestbook With patGuestbook (part 1)
User, User, On The Wall... - PHP
Want to plug into what your site visitors actually think? All you need is a little time, a dollop of imagination and a copy of patGuestbook. More, inside.
So that takes care of the geeky stuff that goes into the back-end of the system. Now, how about actually checking out what a user to your site would see when they launched the guestbook module?
In order to view the user experience for yourself, point your browser to the example script above, at http://localhost/patGuestbook/example.php, and you should see something like this:
You can now use the "Add New Entry" command to enter a comment in the guestbook.
As you can see, the fields displayed correspond exactly to what you specified when configuring the guestbook (just to see if it all works as it should, try leaving out a required field when submitting your comment - patGuestbook should barf and display a whole string of errors). When you're done, use the "Save Entry" button to save your comment, and the application will take you back to the main guestbook page, which should now display the comment you just entered.
You can now link to this script from other pages in your site, and start watching as the comments roll in!
That's about it for the first part of this article. Of course, this isn't all you can do with patGuestbook - in the second part of this article, I'll show you how you can customize the look and feel of the default guestbook, together with instructions on how to moderate and deactivate individual entries. Make sure you come back for that!
Note: All examples have been tested on Linux/i586 with Apache 1.3.28, PHP 4.2 and patGuestbook 1.0. Examples are illustrative only, and are not meant for a production environment. Melonfire provides no warranties or support for the source code described in this article. YMMV!