header

Important Notice for updating to 3.2 final!

If your project was developed with a previous version of Tequila please follow this upgrade guide!

General concepts

Footer and header are sections in your page that goes around the page content, i.e. top menus, side menus, logos, search box, etc.

In PHP is a common practice to split the header / footer code to separate files and include them later, this make change design and site maintenance far easier!

Tequila uses 1 view for each one, this allows this blocks to have it's own template, language files and PHP processing.

Do more with the same

Tequila allows you to reuse your code better by allowing you to use your code with full headers, empty headers or no headers at all, so you can load it in the main page in iframe or in div tags when using AJAX

Header template rules

The header have some rules to work properly, we recommend you to copy all the regions to your header so Tequila can add the Javascript and CSS resources

Sample fo header file

1 <head> 2 <title>{SiteTitle}</title> 3 <META name="description" content="{METADESC}"> 4 <META name="keywords" content="{METAWORDS}"> 5 <META HTTP-EQUIV="Content-Type" content="text/html; charset={charset}"> 6 <META HTTP-EQUIV="Content-Type" content="text/xml; charset={xmlCharset}"> 7 <!-- START BLOCK : redirect --> 8 <meta http-equiv="refresh" content="300;url={LOCATION}"> 9 <!-- END BLOCK : redirect --> 10 <script language="javascript"> 11 <!-- START BLOCK : jsvar --> 12 var {varname} = "{varvalue}"; 13 <!-- END BLOCK : jsvar --> 14 </script> 15 <!-- START BLOCK : javascriptSrc --> 16 <script language="javascript" type="text/javascript" src="{jsSrc}"></script> 17 <!-- END BLOCK : javascriptSrc --> 18 19 <style type="text/css"> 20 <!-- 21 <!-- START BLOCK : css --> 22 @import url("{STYLEFILE}"); 23 <!-- END BLOCK : css --> 24 --> 25 </style> 26 27 </head> 28 <body {bodyScript}>

Header files:

    • Includes/header.php

    • languages/XX/header.php

    • templates/header.htm

Purpose of Header.php

    • PHP code that is common to all pages where the header is shown, normally in this section we display menus, login, logout sections.

    • This file include only PHP code

    • This file have access to every framework function

    • Normal template techniques are used

    • To display / hide elements according to security, you use normal security checking (see security section)

Example of showing a menu to authorized users:

if ($sec->authorize("system.$appname.tasks.confidentialtask")

{

$tpl->newBlock("secured_menu");

}

Language file

Language entries that appear in header section, (these ones are not common language entries but just header section)

Template

The HTML code that is common to all pages

To consider

    • Header template MUST follow the standard, we recommend you to modify the existing file and not just replace it, specially the HTML Head section

    • Remember that header might be included or not in every page, don't add elements that are required for proper display or execution in any section

    • CSS, JS resources don't need to be added here, use config.php or addJS methods in the right sections