Tribiq CMS

Choose your language

5.1 Step-by-Step Common Template Elements

Using Common Template Elements, you can use these quick PHP snippets to implement Tribiq CMS functions across your pages.

If you've been following the previous Step-by-Step guides, your HTML-standard.tpl.php template may look like this:

We are going to now add some common elements to this Template.

5.1.1 How to include the Breadcrumb Trail

A Breadcrumb Trail provides site visitors with a visual representation of the navigational path to the content item. This makes it easy for them to see what section or area of the website they are currently in.

Typically this would live at the top of the page - so let's add it right at the top of our template, together with a wrapper div. Insert this at the top of HTML-standard.tpl.php, just after the reference to the $template_path:

<div id="breadcrumbs">
<?php
include "templateincludes/breadcrumb.php";
?>
</div>

Your HTML-standard.tpl.php template code may now look like this:

<?php
$template_path = "templates/".SITENAME."/".$use_template_family;
?>
<div id="main_holder">
    <div id="breadcrumb">
<?php
include "templateincludes/breadcrumb.php";
?>
    </div>
    <div id="header">
        <img src="&lt;?php echo $template_path;?&gt;/images/logo.gif" alt="My Company Name" />
    </div>
    <div id="topmenu_holder">
        <div id="topmenu_holder_l">
        </div>
        <div id="topmenu_holder_c">
<?php include "templateincludes/topmenu.php";?>
        </div>
        <div id="topmenu_holder_r">
        </div>
    </div>
    <div id="main_content">
<?php
include "templateincludes/content_bodymain.inc.php";
?>
    </div>
<?php
include $template_path."/includes/shortcuts.inc.php";
?>
<?php
include $template_path."/includes/footer.inc.php";
?>
</div>

Save the template file and refresh your Content Item - you'll notice at the top of the page, we now have the Breadcrumb trail.

 

5.1.2 How to include the Search box

To add a searchbox to your HTML-standard.tpl.php template, you will need copy the following file to your new newtemplatefamily/includes folder from the default (bundled) "tribal-GPL-1066" Template:

  • the file tribal-GPL-1066/includes/searchbox.inc.php to includes/

Let's include the following snippet, nested in our header div:

<?php
include $template_path."/includes/searchbox.inc.php";
?>

Your header div now looks like:


    <div id="header">
        <img src="<?php echo $template_path;?>/images/logo.gif" alt="My Company Name" />
<?php
include $template_path."/includes/searchbox.inc.php";
?>
    </div>

 

Save the template file and refresh your Content Item - you'll notice at the top of the page, we now have the Search box.

 

5.1.6 How to include an Extranet Login Box

 

To add an extranet login box to your HTML-standard.tpl.php template, you will need copy the following file to your new newtemplatefamily/includes folder from the default (bundled) "tribal-GPL-1066" Template:

  • the file tribal-GPL-1066/includes/extranet_box.inc.php to includes/

<?php
include $template_path."/includes/extranet_box.inc.php";
?>

This snippet returns a form which provides Username, Password and Submit fields and links to Extranet Registration functions.

When we refresh the template, you will see an unstyled login box:

Warning: Extranet Content Item
If you are starting on a clean Tribiq CMS website an Extranet Content Item may not exist. Therefore you need to create at least one Extranet Content Item before site visitors can use the features of the extranet. You can follow the Add Menu item process and select to create an item with the Extranet Content Type. Make sure you publish this page!

 

Top of Page