PHP
  Home arrow PHP arrow Page 3 - Building A Quick-And-Dirty Guestbook With patGuestbook (part 1)
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Building A Quick-And-Dirty Guestbook With patGuestbook (part 1)
By: Harish Kamath, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 49
    2003-02-28


    Table of Contents:
  • Building A Quick-And-Dirty Guestbook With patGuestbook (part 1)
  • Introductions
  • Home Sweet Home
  • The Voice Of The People
  • Playing The Field
  • Code Poet
  • User, User, On The Wall...

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Building A Quick-And-Dirty Guestbook With patGuestbook (part 1) - Home Sweet Home
    ( Page 3 of 7 )

    Since it's a PHP script, patGuestbook needs to live somewhere under your PHP-aware Web server's document root - typically, somewhere in the directory structure holding the rest of your Web site. For purposes of this tutorial, I shall assume that the application is located in the "patGuestbook" directory under the Web server root, and is accessible at the URL http://localhost/patGuestbook/

    When you uncompress the source archive, you should see a directory structure that looks something like this:

    patGuestbook | | | --- admin | --- config | --- skins | --- include | --- sql
    Once you've got the files in an appropriate location, you also need to create some database tables to store patGuestbook data (if you're already using a database for your site, simply add patGuestbook's tables to that database). Look in the source archive's "sql" directory, where you'll find an SQL script to create two tables - "patgbguestbooks", which holds the master list of all the active guestbooks, and "patgbentries", which stores the actual guestbook entries.

    Here's a quick glance at the SQL commands to create these tables:

    DROP TABLE IF EXISTS patGbEntries; CREATE TABLE patGbEntries ( id int(10) unsigned NOT NULL auto_increment, guestbook int(10) unsigned NOT NULL default '0', date datetime NOT NULL default '0000-00-00 00:00:00', name varchar(100) default NULL, email varchar(200) default NULL, homepage varchar(200) default NULL, entry text NOT NULL, comment text, ratings text, flags set('approved') default NULL, PRIMARY KEY (id), KEY guestbook (guestbook), KEY flags (flags) ) TYPE=MyISAM; # -------------------------------------------------------- DROP TABLE IF EXISTS patGbGuestbooks; CREATE TABLE patGbGuestbooks ( id int(10) unsigned NOT NULL auto_increment, name varchar(20) NOT NULL default '', template varchar(255) NOT NULL default '', owner varchar(255) default NULL, entriespp tinyint(3) unsigned NOT NULL default '0', flags set('moderated','disabled','notify') NOT NULL default '', fieldconf text, PRIMARY KEY (id), UNIQUE KEY name (name) ) TYPE=MyISAM;
    Next up, configuration. patGuestbook configuration is handled via a single file named "patGuestbook.php", located in the source distribution's "config" directory. It's fairly self-explanatory, take a look:

    <?PHP /** * patGuestbook Config */ // Database configuration $db_host = "localhost"; $db_name = "patGuestbook"; $db_user = "me"; $db_pass = "secret"; // Directory where the templates for subscription pages are stored $skins_dir = "skins"; // Directory where the templates for the administration are stored $admin_template_dir = "templates"; ?>
    Most of this is pretty standard information - patGuestbook needs to know the database access parameters so that it can get to its tables, and the location of the directories containing screen templates for the guestbook administration module and the guestbook itself (these templates are used by the patTemplate engine to render each page of the application, and can be customized to your needs - more on this later).

    If you're using the default installation, you shouldn't need to change any of the information in this file, except the database access parameters. If, on the other hand, you're not using the default installation paths and are plan to integrate patGuestbook into your existing site structure, you should also alter the directory locations in the configuration file to reflect where the templates are located.

    You can now check to see if patGuestbook is up and running, by visiting the URL (remember to alter this as per the installation path on your system): http://localhost/patGuestbook/example.php

    patGuestbook should load up and display the following error message:

    Could not identify guest book!
    No need to panic - this is just an indication that the application could not find any guestbook in the system. This is probably because you have not yet created one - but hey, at least it confirms that you've got my configuration right.

    Next, how about wiping out that error message by actually creating a guestbook?

     
     
    >>> More PHP Articles          >>> More By Harish Kamath, (c) Melonfire
     

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek