Thank you for your interest in our Guestbook Script. We recommend to read this documentation carefully.
The script has been configured in a way that makes it ready to use. After uploading all script files to your web server by FTP and running the database table installation routine you can work with the script. When you intend to edit the script you should do that step by step. After each change you should run the script to monitor the effects. Doing so enables you to know what change causes an error.
The HTML templates of the script have been generated by the specifications of XHTML 1.0. HTML tags like <br> or <input> contain an ending slash (<br /> or <input type="text" name="feld" />).
The script works like a classic guestbook script. Visitors of your website can read an entry list - last entry first. The visitor can sign the guestbook by using a form.
The administrator can edit and delete guestbook entries. The admin can login via login.php by using the database access data (username and password). After logging in each entry will be expanded by additional information such as IP address and browser and the delete and edit links as well.
Top
The file "config.php" is the configuration file of the script. To edit the settings open the file in a text editor (i.e.: Wordpad under MS Windows). The following variables can be edited:
$add_text = array( 'txt_additional' => 'Additional', 'txt_more' => 'More' );
The first part of each entry is the name of the placeholder. In case you want to use the value of 'txt_addition' in your template enter the name of the entry with curly brackets - {txt_addition}. The name must not contain white spaces or special characters. Only allowed is the _ .
Create the following folders on your web server (with the most FTP clients you are able to copy the hole script with all folders in one go):
/guestbook/ /guestbook/inc/ /guestbook/languages/ /guestbook/templates/
Copy all files to their corresponding folder. Image files (.gif, .jpg, .png) have to be uploaded in binary mode. Every other files have to be uploaded in ASCII mode (text mode).
After uploading the script files to the web server open file "index.php" in your browser. Since the database tables have not been installed yet an installation page will be called automatically. However, you need to enter the MySQL access data in the file "config.php" in the first place. You will get those access data when you create a database or ask your web space provider. Description of the $database variables:
When you have entered all data and uploaded all updated files you can install the database tables. When you first run the Guestbook Script you will get an installation page. Click on the green submit button. After a successful installation the script should run.
The file "form_config.php" contains the form field configuration. Each form field will be defined in the following pattern:
$new_form_fields[] = array( 'name' => 'name', 'label' => 'Name', 'type' => 'text', 'required' => 'yes', 'value' => '' );
Every form field definition contains certain elements:
Beside the original script options you can add your own options. Those options will be added to the form field automatically. Possible options would be: maxlength, size, cols, rows, selected, checked. You can also add CSS content like: class, style.
Example:
$new_form_fields[] = array( 'name' => 'comment', 'label' => 'Kommentar', 'type' => 'textarea', 'required' => 'yes', 'value' => '', 'cols' => '20', 'rows' => '10', 'style' => 'padding:5px;' );
This form field definition produces a multi line text field ('type' => 'textarea') with the intern name "comment" ('name' => 'comment'). On the HTML page appears the label "Comment" ('label' => 'Comment'). This field is required to fill in ('required' => 'yes'). The visitor have to enter a value to write a guestbook entry. No default value is defined ('value' => ''). The text field has a width of 20 columns ('cols' => '20') and a height of 10 rows ('rows' => '10'). Additionally the field gets a margin of 5 pixel - defined by CSS ('style' => 'padding:5px;').
To see how the form field configuration works you can take a look at the file "form_config_example.php" where every possible form field has been defined. The corresponding HTML template is "form_detail_example.tpl.html". Open the file "sign_example.php" to see how the form looks in your browser.
Please open the template "form_detail.tpl.html" in your text editor to see how the form fields are placed.
The form field definition produces automatically two placeholders: {label:...} and {field:...}. The dots can be replaced by the name of the form field, i.e.: {label:name} and {field:name} or {label:comment} and {field:comment}.
The placeholder {label:...} contains the name of the form field that you want to show to the visitor. The placeholder {field:...} contains the HTML code of the form field, i.e.: <input type="text" name="name" value=" " size="30" style="width:350px;" />
The form field names also appear as placeholders ({name} or {comment}) in the template "entry_detail.tpl.html" within the LOOP block . They will be replaced by the values that are stored in the database.
The directory "templates/.../" contains the files for the layout. You can use HTML and CSS to customize the layout as you wish. The already existing subfolders "derfault" and "simple" are examples how to customize the guestbook.
In case you are using a WYSIWYG editor like Dreamweaver, Frontpage or NetObjects please make sure the software does not make any changes by itself.
The template files contain markers with curly brackets { and } like: {txt_next_page}. These markers will be replaced by its counterparts from the language file "languages/language.en.inc.php". You are free to edit that file and change the words and phrases. You are also free to replace the markers within the template files by real words or put those markers to other positions within the template file. And you are also able to enhance the language file by using the given pattern.
Amongst those word markers exist the so called loops. Similar to HTML tags the two parts (<LOOP …>…</LOOP>) must not be separated. If you want to alter the position within the template you need to move the hole block.
There are also IF blocks. These are to display or remove parts of the HTML code under certain conditions. The IF blocks can be handled in the same way as the loop blocks.
main_layout.tpl.html
This file can contain the layout elements that apply for all pages. All guestbook pages are then using automatically the same layout. You can leave this file empty and define an individual layout for each guestbook page.
The file contains the special placeholder {main_content}. This placeholder will be replaced by the script with the content of the detail templates. This placeholder must not be removed or altered - even if the file shall not contain any layout content.
The main template contains also the placeholder {txt_title} within the title tag (<title>...</title>). That placeholder has been defined in the file "config.php" in the variable $add_text. The used variable $script_title can be defined within the several PHP files (index.php, delete.php, edit.php, login.php, sign.php). Just enter the page title you want.
entries.tpl.html
This file contains the layout of the guestbook entry page. It contains the following elements:
<IF NAME="logged_in">
If the administrator has been logged in, the log out link will be displayed.
{txt_entries} {txt_page} {currentpage} {txt_page_of} {allpages}
These placeholders contain information about number of guestbook pages and the number of the current page.
<IF NAME="previous_result_page">
This IF block contains navigation links.
<IF NAME="page_link_start"> <IF NAME="page_link_end">
If you have limited the number of direct links to the guestbook pages the content of these IF block will be displayed at the beginning or/and the end of the link list.
<LOOP NAME="page_direct">
Within this LOOP block the direct links to the guestbook pages will be displayed. You will get a link list that consists of numbers (1 2 3 4 5 6 7 8 9 ...).
<IF NAME="next_result_page">
{entry_detail}
The detail layout of the guestbook entries are stored in the file "entry_detail.tpl.html".
entry_detail.tpl.html
<LOOP NAME="guestbook_entries">
Within this LOOP block appear the names of the form fields as placeholders (i.e.: {name} or {comment}). These placeholders will be replaced by database values.
sign.tpl.html edit.tpl.html
<LOOP NAME="message">
This LOOP block displays notes and error messages, i.e. when a required field has not been filled in by the user.
{form_detail}
This placeholder will be replaced by the content of the form detail template "form_detail.tpl.html".
form_detail.tpl.html
You will find answers to your questions and solutions for your problems with the script in our support forum.
You can download the script without registration und use it for free. If you want to use the script without the reference to STADTAUS.com, you can purchase the script online (19 US$/19 Euro).
Contact: http://www.stadtaus.com/en/
More scripts on STADTAUS.com:
Please also visit our project MetaCollection, a guide for webmasters and developers who are in search of CGI, Perl, or PHP script archives.
http://www.metacollection.com/