Variables that can be used in Templates

The variables that can be used in the html templates are listed next. Each of these variables can be used by putting them in curly brackets and prefix with $ Example: {$pgb_image_dir}

For the php styles the same variables exist, but the have to be prefixed by $tpl. Example: $tpl_pgb_image_dir. Language Constans are a exception (sorry :-) to this rule, they are accessed by using '_' as prefix. Example: _PGB_CAP_CANCEL.

JavaSript in Smarty can be included in a {literal} {/literal} block. Text within this block is not parsed by smarty -> { and } can be used without problems.

Encompass uses [- and -] as delimiters which also makes { and } available for free use.

Example 4-2. using JavaScript in Smarty

           
{literal}
<script type="text/javascript">
<!--
function insertSmilie(aSmilie)
{
   var message_ctrl = document.pgb_form.pgb_message;
   message_ctrl.value= message_ctrl.value + aSmilie;
   message_ctrl.focus();
   return false;
}
-->
</script>
{/literal}
    
           

Table 4-1. Language Constants

VariableMeaning
PGB_CAP_CANCELCancel
PGB_CAP_CHANGEChange
PGB_CAP_EMAILe-mail
PGB_CAP_HOMEPAGEHomepage
PGB_CAP_LOCATIONLocation
PGB_CAP_MESSAGEmessage
PGB_CAP_NAMEname
PGB_CAP_PREVIEWpreview
PGB_CAP_SIGNsign
PGB_CAP_DISABLE_BBCODE 
PGB_CAP_DISABLE_HTML 
PGB_CAP_DISABLE_AUTOLINKS 
PGB_CAP_COMMENT 
PGB_CREATE_ENTRYcreate
PGB_EMAIL 
PGB_ENTRY_COUNT_MSG 
PGB_FROM 
PGB_HOMEPAGE 
PGB_ON_DATE_FORMAT 
PGB_PAGE' 
PGB_TITLE 
PGB_TITLE_ADD_ENTRY 
PGB_TITLE_PREVIEW 
PGB_WELCOME_MSG 
PGB_WROTE 

Table 4-2. global available template variables

VariableMeaning
styleName of the current style/theme
entriesList of entries, Instances of class entry
entryactual entry, Instance of class entry
entry_countNumber of entries in the list
curl_open} -> {ldelim} can be used for left delimiter
curl_close{ -> {rdelim} can be used for right delimiter
pgb_image_dirpath to images of current style
pgb_moddirbasedirectory of the module
isadminboolean: is the current user allowed to admin the guestbook
langcurrent user language, e.g. eng
pagesarray of page-numbers from 1 to number of pages
current_pagenumber of the current page
number_of_pagestotal number of pages
pgb_admin_delete_urlurl for deleting a entry
pgb_start_urlURL that leeds to the guestbook
pgb_date_formatdateformat for current user
pgb_commentadmin comment
pgb_error_messageerror message
pgb_statusstatus or error message - if error is present overwrites status
pgb_status_alertjavascript code presenting a error message in a message box
pgb_is_bbcode_enabledtrue if bbcode is installed and enabled by admin
pgb_is_html_enabledtrue if html in posts is enabled
pgb_is_autolink_enabledtrue if autolinks are enabled
rowcolorarray of two colors used for different coloring of odd and even rows
bgcolor1Theme: bgcolor1
bgcolor2Theme: bgcolor2
bgcolor3Theme: bgcolor3
bgcolor4Theme: bgcolor4
bgcolor5Theme: bgcolor5
textcolor1Theme: textcolor1
textcolor2Theme: textcolor2
opentableTheme: Result of OpenTable() function
closetableTheme: Result of CloseTable() function
opentable2Theme: Result of OpenTable2() function
closetable2Theme: Result of CloseTable2() function

Note: optentable, opentable2, closetable and closetable2 don't work with Encompass!

The entries for a page of the guestbook are in a array called entries. Each row in this array contains a Instance of the class GuestBookEntry found in pnuserapi.php. The members in this class can be accessed using '->'.

Example 4-3. accessing Class members

           
    <!-- print the name of all postings -->
    {foreach from=$entries item=entry name=entries}
       {$entry->name}
    {/foreach}
    
           

Table 4-3. member of the GuestBookEntry class

MemberMeaning
idid, primary key
namename
messagemessage the user want's to post
emailemail
homepagehomepage
locationlocation
moodmood (not used in default style)
private_msgflag for private message (not used till yet)
timestamptimestamp of the posting
ipip address of the poster, should only be show to admins
user1content of admin defined field 1
user2content of admin defined field 2
user3content of admin defined field 3
user4content of admin defined field 4
user5content of admin defined field 5
disable_htmlflag if html is disabled for this entry
disable_bbcodeflag if bbcode is disabled for this entry
disable_autolinksflag if autolinks are disabled for this entry
pn_user_idPostNuke User Id, if the post was made by a registered user
avataravatar of the user (avatar.gif)
avatar_imghtml code for avatar img <img src="...>

Variables that can be only be used in entry_submit.tpl and entry_edit.tpl.

Table 4-4. variables only available in new and edit

VariableMeaning
pgb_idid, primary key
pgb_namename
pgb_messagemessage the user want's to post
pgb_emailemail
pgb_homepagehomepage
pgb_locationlocation
pgb_moodmood (not used in default style)
pgb_private_msgflag for private message (not used till yet)
pgb_timestamptimestamp of the posting
pgb_user1content of admin defined field 1
pgb_user2content of admin defined field 2
pgb_user3content of admin defined field 3
pgb_user4content of admin defined field 4
pgb_user5content of admin defined field 5
pgb_submit_urlurl for submitting a entry
pgb_disable_htmlflag if html is disabled for this entry
pgb_disable_bbcodeflag if bbcode is disabled for this entry
pgb_disable_autolinksflag if autolinks are disabled for this entry
pgb_pn_user_idPostNuke User Id, if the post was made by a registered user
pgb_avataravatar of the user (avatar.gif)
pgb_avatar_imghtml code for avatar img <img src="...>
pgb_bbcode_html html code for integrating bbcode buttons in edit template.
authid authentication id for edit template, used in hidden control. Only needed when updating an existing entry.