2.4 Template Includes
Your Templates will contain PHP includes that provide CMS functionality to your templates. However, you may also want to create your own includes, such for a common header or footer in your design.
2.4.1 A quick PHP lesson
This takes a little PHP skill, but is well worth it to improve uniformity of design across your Template Family. Typically you can include a file, which may just be a block of HTML, using the following syntax:
<?php include 'myfile.inc.php'; ?>
Let's quickly deconstruct this:
<?php
This tells your document to interpret the following code as PHP
include
This is a PHP function. A function will process a variable or file in a certain way. The "include" function will grab the contents of the file and write them to the page as if the include's content was originally written on the host page.
'myfile.inc.php'
This is the file we want to include. We use a suffix naming convention of .inc.php to remind us that this file is usually included on a page, and may not function if it was accessed directly.
;
The semi-colon tells PHP that this is the end of the instruction.
?>
The end tag in PHP is represented by a question mark and a greater than symbol. This tells the document that the PHP code has now finished. PHP is executed like a program, rather than displayed like HTML. In Tribiq CMS templates you will often see them written in the single-line form (as in the example), but PHP code may well stretch over many lines.
Inside the templateincludes/ directory are all the commonly-used artefacts, such as search boxes, CMS-driven menus, and so on.
2.4.2 Current Includes
Here is a list of the current Template Includes:
- breadcrumb.php - Shows the navigation path to the current content item
- calendar.inc.php - Provides the month view calendar
- /captcha - The anti-spam/anti-bot image tool
- cmserror.php - Provides system-wide error handling
- contact_form_functionality.inc.php - Contact Form Functionality
- content_bodyfoot.inc.php - used to include content
- content_bodymain.inc.php - used to include content
- content_bodytop.inc.php - used to include content
- doclist.inc.php - Lists all available documents
- document.inc.php - Provides document download functionality
- event.inc.php - Displays event details
- event_day_view.inc.php - Displays day details
- extranet_form_functionality.inc.php - Extranet functionality
- forum.inc.php - Forum functionality
- forum_functionality.inc.php - Forum functionality
- gallery.inc.php - Used to create gallery from picture content items
- gallery_content.inc.php - Used to create gallery from picture content items
- news_listing.inc.php - News listings
- params.inc.php - Handles template parameters
- picture.inc.php - Handles picture content type
- search.inc.php - Handles simple search template
- searchbox.inc.php - Provides searchbox
- search_functionality.inc.php - Search functionality
- search_new.inc.php - Handles advanced/tabbed search template
- shortcuts.inc.php - Handles Shortcuts
- side_menu.inc.php - Provides a Side menu
- topmenu.php - Provides a Top menu
If you are new to the idea of CMS templates, we suggest you have a quick look at some files in this folder but don’t modify them. It will give you an idea of the structure of the HTML that will be produced by the PHP snippets.
You may find that you will want to modify some of these files in the future. If you create your own includes, such as headers and footers, you should place these in:
templates/mysitename/templatefamily/templateincludes
(where templatefamily/ is the name of your Template Family).
Top of Page