Mambo Open Source/Convert templates from 4.5 to 4.5.x
TOC |
---|
Chapters |
Home |
Configuration |
Design |
Content |
Development |
Miscellaneous |
Convert templates from 4.5 to 4.5.x
[edit | edit source]A mambo template uses variables and operators in the Mambo core system, and some of these may change during the development of Mambo. Most templates created for version 4.5 of Mambo will work with the newer versions of 4.5.x, but there are some precautions to be aware of.
A 4.5.x compatible template will be 100% compatible with the future release of version 5.0. 4.5.x also has some functions that 4.5 templates doesn't, like the top-menu.
How to upgrade
[edit | edit source]Pathway
[edit | edit source]In 4.5 the pathway was a reference to a file called "pathway.php". 4.5.x is different here, and uses a function called "mosPathWay".
4.5 | 4.5.x |
---|---|
<?php include_once("pathway.php"); ?> | <?php mosPathWay(); ?> |
Mainbody
[edit | edit source]In 4.5 the mainbody was a reference to a file called "mainbody.php". 4.5.x is different here, and uses a function called "mosMainBody".
4.5 | 4.5.x |
---|---|
<?php include_once("mainbody.php"); ?> | <?php mosMainBody(); ?> |
Global variables
[edit | edit source]Some of the core config-variables have changed too, here they are:
4.5 | 4.5.x |
---|---|
$mosConfig_live_site | $GLOBALS['mosConfig_live_site'] |
$mosConfig_absolute_path | $GLOBALS['mosConfig_absolute_path'] |
$mosConfig_sitename | $GLOBALS['mosConfig_sitename'] |
$mosConfig_offset | $GLOBALS['mosConfig_offset'] |
Pathway-separator
[edit | edit source]4.5.x has a new feature for the pathway arrow. In the Mambo generated pathway of the "mosPathWay"-function, an arrow image appears between the pathway links. This can be a custom arrow for each template, and it is very simple to use this feature.
Simply create an image that you want for this, save it in .png-format, call it "arrow.png" and place it in the root folder of the template you want it in, the same as the "template_details.xml" and "index.php" files. If this doesn't work, try putting it in the images sub-folder. What the heck, put it in both places.
Remember to create a reference to this file in the "template_details.xml" file, so that it is uploaded when installing the template through the Mambo Template Installer.
The head code
[edit | edit source]The head code has also been upgraded from 4.5.
If you don't use any custom functions and includes in the <head> tag, use this code:
<?php
/**
* Here you can writes notes about the template
* It has no technical effect, It is merely for
* information purposes.
*/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$iso = split( '=', _ISO );
echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php if ( $my->id ) initEditor(); ?>
<meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
<?php mosShowHead(); ?>
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['mosConfig_live_site']; ?>/templates/yourtemplatesname/css/template_css.css" />
</head>