Common Template Elements (Reference)
How to include the Breadcrumb Trail
<?php
include "templateincludes/breadcrumb.php";
?>
This code will provide you with a breadcrumb trail. The output is structured like:
<div id="breadCrumbs">
<ul id="topFamily">
<li><a href="/z.html">x</a> »
<a href="/y.html" >y</a> »
<a href="/z.html" >z</a> »
</li>
</ul>
</div>
How to include the Search box
You must change the “cID” value to reflect the alias of the Search Results page you would like the form to use.
You must use a Search template (e.g. HTML-search.tpl.php) for the cID that you specify.
<form method="POST" action="?cID=CHANGE_THIS" onSubmit="return validateForm(this);">
<div id="search_text">
<input type="text" id="searchterm" required="true" cssErrorClass="input_text_error" name="searchterm" maxlength="30"
</div>
<div id="search_btn">
<input name="submit" value="Search" type="submit" class="submitbtn" title="Search" />
</div>
</form>
$searchterm is the variable that contains the search term. You can reference $searchterm on your Search templates.
How to include main content sections
Using the following PHP snippets, you can include the editable (WYSIWYG) areas on a Content Item.
<?php
include "templateincludes/content_bodytop.inc.php";
?>
<?php
include "templateincludes/content_bodymain.inc.php";
?>
<?php
include "templateincludes/content_bodyfoot.inc.php";
?>
In Public Mode, these snippets return the content of the published version. In Admin Mode, these includes return the content of the latest private draft and also provide edit icons for you to edit the content.
How to include a Language Selector (by Flags)
<?php
include
"templateincludes/lang_selector.inc.php";
?>
This snippet returns a <div> with an unordered list of Flags for each active language (an "active" language has at least one published page).
How to include an Extranet Login Box
<div id="extranet_box">
<h1>
<?php echo getVLPPhrase("_EXTRANET_AREA") ?>
</h1>
<?php if (!$_SESSION['extranetUserID']) { ?>
<div id="ExtranetHolder">
<div id="ExtranetBoxForms">
<form id="login" action="<?php echo SUBDIRECTORY ?>?cID=1&cType=extranet" method="post" onsubmit="return validateForm(this);">
<fieldset>
<input type="hidden" name="fake_submit" value="fake_value" /> <input type="text" class="extranet_box_field" name="email" id="email" value="<?php echo getVLPPhrase(" _email_hint") ?>" onfocus="if(this.value=='
<?php echo getVLPPhrase("_EMAIL_HINT") ?>
')this.value='';" />
<br />
<input type="password" class="extranet_box_field" name="password" id="password" /> <input type="submit" class="extranet_box_image" name="submit" value="Login" />
</fieldset>
</form>
</div>
<div id="ExtranetBoxActions">
<ul>
<li>
<a href="<?php echo SUBDIRECTORY ?>?cID=1&cType=extranet&mode=forgottenpss">[
<?php echo getVLPPhrase("_FORGOTTEN_PASSWORD?") ?>
]</a>
</li>
<li>
<a href="<?php echo SUBDIRECTORY ?>?cID=1&cType=extranet&mode=register">[
<?php echo getVLPPhrase("_NEW_USER") ?>
]</a>
</li>
</ul>
</div>
</div>
<?php } else { ?>
<div id="ExtranetHolder">
<div id="ExtranetBox_authed">
<ul>
<li>
<a href="<?php echo SUBDIRECTORY ?>?cID=1&cType=extranet">
<?php echo getVLPPhrase("_WELCOME", array('user' => $_SESSION["extranetUser_firstname"])); ?>
</a>
</li>
<br />
<li>
<a href="<?php echo SUBDIRECTORY ?>?cID=1&cType=extranet&mode=edituser">
<?php echo getVLPPhrase("_EDIT_USER") ?>
</a>
</li>
<li>
<a href="<?php echo SUBDIRECTORY ?>?cID=1&cType=extranet&mode=changepss">
<?php echo getVLPPhrase("_CHANGE_PASSWORD") ?>
</a>
</li>
<li>
<a href="<?php echo SUBDIRECTORY ?>?cID=1&cType=extranet&mode=logout">
<?php echo getVLPPhrase("_LOGOUT") ?>
</a>
</li>
</ul>
</div>
</div>
<?php } ?>
</div>
This snippet returns a form which provides Username, Password and Submit fields and links to Extranet Registration functions.
How to include a News Listing box
To include a News Listing box, your template must define a few parameters that control:
- How many listings you see
- Character limit (of the abstract)
- Which language to pick from
- Date format
- Date format in relation to language
As you can see in the snippet below, some of these parameters are controlled by the siteConfig variables - these are Site Settings, and are configurable in the Admin Control Panel.
<?php
$news_listings_limit = $siteConfig['news_listings_limit'];
$default_char_limit = $siteConfig['default_char_limit'];
$lang = $item_meta['language_id'];
$format_type = $siteConfig['vis_date_format_med'];
$datelang = ""; // Goes into format Date language_id
include "templateincludes/news_listing.inc.php";
?>
This snippet returns each news article in a container <div>. The structure of a news item is:
<div class="newsArticle">
<div class="newsTitle"> <h2><a href="/?cID=x&cType=news">Title</a> <div id="newsDate">Date</div></h2>
</div>
<div class="newsThumb">
<p>Thumbnail</p>
</div>
<div class="newsContent">Content</div>
</div
Top of Page