PHP Classes
elePHPant
Icontem

File: guestbook_example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Taylor  >  Guestbook v1  >  guestbook_example.php  >  Download  
File: guestbook_example.php
Role: Example script
Content type: text/plain
Description: example of the guestbook class in use
Class: Guestbook v1
Post and display comments in a guestbook
Author: By
Last change:
Date: 8 years ago
Size: 2,881 bytes
 

Contents

Class file image Download
<?php
require_once('inc/classes/paging.class.php');
require_once(
'inc/classes/guestbook.class.php');
$guestbook = new Guestbook(); // create a new instance of the guestbook
$guestbook->GuestbookPage = 'https://www.mydomain.com/guestbook.php'; // the location of the guestbook page on ur site.
$guestbook->EmailsFrom = 'GuestbookEntry@mydomain.com'; // where do the emails come from inrelation to the guestbook
$guestbook->ConfirmMessage = 0; // set this to 1 if you want to email whoever submits the form letting them know to that it has been submitted.
$guestbook->SubmitConfirmationEmail = 'This is the message which is sent to people if you set ConfirmMessage'; // the message which is sent to the person who submitted the form
$guestbook->myEmail = 'myemail@domain.com'; // set the email you want the guestbook entrys going to;

$guestbook->checkAddorDelete();

if(isset(
$_POST['addToGuestbook'])) {
    if(
$guestbook->CheckForm($_POST) == true) {
       
$guestbook->FormError = 'Guestbook submission sucessfull.';
       
$guestbook->SendConfirmEmail();
    } else {
        if(!isset(
$guestbook->FormError)) {
           
$guestbook->FormError = 'Please ensure "Name", "Title" and "Message" fields are filled in.';
        }
    }
}
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Guestbook Example</title>
</head>

<body>

           
<?php

$guestbook
->TableWidth = 690; // set the width of the guestbook table
$guestbook->TableBorder = 0; // set the border of the table
$guestbook->NameAlign = 'right'; // does the author of each log, align left, right or middle ?
$guestbook->TableId = 'guestView'; // the id for the table
$guestbook->TdClass = 'rows'; // the class for the td's in the table .. padding, bg color..etc
$guestbook->DivTitleClass = 'guestTitle'; // the div class name for the title section
$guestbook->DivTimeClass = 'guestTime'; // the div class name for the time section
$guestbook->DivAuthorClass = 'guestAuthor'; // the div class name for the author section
$guestbook->Add_TextInputSize = '30'; // size for the input text fields in the add form
$guestbook->Add_TextareaSize = '550px'; // width for the text area, eg: 24em, 1em, 100%, 50%, 10px, 100px . . .
$guestbook->Add_TextareaHeight = '100px;'; // height for the textarea, eg: 24em, 1em, 100%, 50%, 10px, 100px . . .
$guestbook->MessageLimit = 500;


$guestbook->JavascriptMessageLimit();
$guestbook->JavascriptShowHide(); // make sure to include the javascript for the show / hide of the 'add to guestbook' link
$guestbook->showEntrys(); // draw the page elements
?>



</body>
</html>