Make your own free website on Tripod.com

Creating your own design templates for Logbook

Contents


Introduction

Would you like to create your own designs for Logbook?
This document lists the special tags you will need in order to create your own designs.

It's very straight-forward. First view the existing .tmpl files to see how things work, then use this reference to build your pages. You should be able to cut-and-paste the tags into your HTML documents.

How do the templates work?
The tags are used by the script so that it knows where to insert the data. This is known as templating. The template is a regular HTML document which includes these special tags used by the script.

Following, is a script by script listing of the special tags, what they do and how to use them.
You can call your template files anything you like as long as you adjust the name accordingly in the logbook_config.pl file.

Note: It is not necessary to enclose the TMPL tags inside comment tags "<!-- -->". I have done this because my HTML editor highlights comments in a seperate colour, thereby making it easier to recognise the TMPL tags. You can remove the comment tags if you find them confusing.

[ Top of Page ]

logbook.pl template

1) Optional . The link to the script itself.

<A HREF="<!-- TMPL_VAR NAME = "BASE_URL" -->logbook.pl">Logbook</A>

2) Optional. The link to adding a new entry. This is only for the person keeping the logbook. You may wish to omit this link.
It's main purpose is convenience for the logbook keeper who doesn't have to remember the URL.

Note: The actual script logbook_new.pl should be password protected. See the installation instructions for more details.

<A HREF="<!-- TMPL_VAR NAME = "NEWLOG_URL" -->">*New*</A>

3) This outputs the list of entries.

<!-- TMPL_LOOP NAME = ENTRIES_LIST_LOOP -->
<P>
<A HREF="<!-- TMPL_VAR NAME = "BASE_URL" -->logbook.pl?file=<!-- TMPL_VAR NAME = ENTRY_NUMBER -->"><!-- TMPL_VAR NAME = ENTRY_NAME --></A>
</P>
<!-- /TMPL_LOOP -->

4) The entry title

<!-- TMPL_VAR NAME=ENTRY_TITLE -->

5) The entry text

<!-- TMPL_VAR NAME=ENTRY_TEXT -->

6) If somebody clicks on "view comments", the condition is true and comments are shown. Otherwise this is skipped. You can change anything except the actual TMPL tags.

<!-- TMPL_IF NAME=SHOW_COMMENTS -->
<hr>
<p>Comments by other visitors:</p>
<!-- TMPL_LOOP NAME = COMMENTS_LOOP -->
<hr>
<STRONG><!-- TMPL_VAR NAME = "NAME" --></STRONG> wrote:
<P><!-- TMPL_VAR NAME = "COMMENTS" --></P>
<!-- /TMPL_LOOP -->
<!-- /TMPL_IF -->

7) Navigation bar. This condition checks whether there is an entry to display. If there is the navigational links are displayed. Otherwise nothing is displayed, which is the case when you first open the logbook with ".../logbook.pl".
The tag is closed after all navigational links have been displayed.

<!-- TMPL_IF NAME="CURRENT_ENTRY"-->

8) If a previous (older) entry exists in the list, then a link is displayed to that entry. ("Previous" link)

<!-- TMPL_IF NAME="PREVIOUS_ENTRY"-->
<A HREF="<!-- TMPL_VAR NAME = "BASE_URL" -->logbook.pl?file=<!-- TMPL_VAR NAME = "PREVIOUS_ENTRY" -->">&lt;- Previous</A>
&nbsp;
<!-- /TMPL_IF -->

9) If newer entry exists in the list, then a link is displayed to that entry. ("Next" link)

<!-- TMPL_IF NAME = "NEXT_ENTRY" -->
<A HREF="<!-- TMPL_VAR NAME = "BASE_URL" -->logbook.pl?file=<!-- TMPL_VAR NAME = "NEXT_ENTRY" -->">Next -&gt;</A>
<!-- /TMPL_IF -->

10) If comments exist for the current entry, then a link to view the comments is displayed.

<!-- TMPL_IF NAME="EXIST_COMMENTS"-->
<A HREF="<!-- TMPL_VAR NAME = "BASE_URL" -->logbook.pl?file=<!-- TMPL_VAR NAME = "CURRENT_ENTRY" -->&mode=show_comments">~view comments~</A>
<!-- /TMPL_IF -->

11) Displays a link allowing visitors to add a comment to the current entry.

<A HREF="<!-- TMPL_VAR NAME = "BASE_URL" -->logbook_comment.pl?file=<!-- TMPL_VAR NAME = "CURRENT_ENTRY" -->&mode=show_form">~add comment~</A>

12) Closing tag for the navigational links.

<!-- /TMPL_IF -->

[ Top of Page ]

logbook_new.pl template

1) Optional. You only use this if you set the script password in the config. Displays an error if the password is incorrect.

<!-- TMPL_IF NAME = "PASSWORD_ERROR" -->
<P>
<!-- TMPL_VAR NAME = "PASSWORD_ERROR" -->
</P>
<!-- /TMPL_IF -->

2) Displays an error message if one or both of the form fields (title and text) were not filled in.

<!-- TMPL_IF NAME = "FORM_INPUT_ERROR" -->
<P>
<!-- TMPL_VAR NAME = "FORM_INPUT_ERROR" -->
</P>
<!-- /TMPL_IF -->

3) This is the opening form tag. (Don't forget to close the tag)

<form method=POST action="<!-- TMPL_VAR NAME = "NEWLOG_URL" -->">

4) Optional. This is only required if you are using a password in the script. (see 1) above)

<!-- TMPL_IF NAME = "REQUEST_PASSWORD" -->

Enter the input field here.An example:

<TD width=100 align=left>Password:</td>
<td align=left>
<input type=password name="passwd" size=30 maxlength='60'>
</td>

<!-- /TMPL_IF -->

[ Top of Page ]

logbook_comment.pl template

1) This shows an error message if somebody entered a comment which exceeded the text limit you set.

<!-- TMPL_IF NAME = "COMMENT_MAX_ERROR_MESSAGE" -->
<P>
<!-- TMPL_VAR NAME = "COMMENT_MAX_ERROR_MESSAGE" -->
</P>
<!-- /TMPL_IF -->

2) This displays an error message if one or both of the form fields (name and text) were not filled in.

<!-- TMPL_IF NAME = "FORM_ERROR_MESSAGE" -->
<P>
<!-- TMPL_VAR NAME = "FORM_ERROR_MESSAGE" -->
</P>
<!-- /TMPL_IF -->

3) This is the opening form tag. (Don't forget to close the tag)

<form method=POST action="<!-- TMPL_VAR NAME = "BASE_URL" -->logbook_comment.pl">

4) The name field.

<input type=text name="name" size=40 value='<!-- TMPL_VAR NAME = "EXISTING_NAME" -->'>

5) The text field for the actual comment.

<textarea name=text COLS=40 ROWS=8><!-- TMPL_VAR NAME = "EXISTING_TEXT" --></textarea>

[ Top of Page ]