Hi, Guys,
Those are tips to convert your Joomla 1.0 template to Joomla 1.5 template w/o turn on legacy mode.
Please report any issue/bug/error you found during conversion, so I can try my best to keep everything up to date.
I also attached a sample file contained the "rhuk_solarflare_ii" template came with Joomla 1.0 but in Joomla 1.5 version.
However, the attached converted template might distort if we got longer content title, which might not be conversion problem.
I'll pay extra attention to 1.5 template part and also provide any update here.
Thanks Ian for his MVC tutorial, and here is my template conversion tutorial. :pop
!!! PLEASE
DO NOT distribute/use this content to any other place
except Joomla Official Site!!!
PHP Part* replace
Code:
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
with
Code:
defined('_JEXEC') or die('Restricted access');
* remove $mosConfig_live_site and change to relative path
replace $mosConfig_live_site with $mainframe->getCfg( 'live_site' );
$mainframe->getCfg( 'live_site' ); is no longer available.
Reference:
Link* replace
Code:
$GLOBALS['mosConfig_absolute_path']
with
Code:
$mainframe->getCfg('absolute_path')
OR You can use
Code:
dirname(__FILE__)
to get the absolute path.
* add language specification to your header
Code:
<!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" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
* replace
Code:
mosShowHead();
with
Code:
<jdoc:include type="head" />
* replace
Code:
$mainframe->getTemplate();
to get the current template name in order to tell the folder path
Code:
<?php echo $this->template ?>
* remove
Code:
if ( $my->id ) {
initEditor();
}
"When the system renders the head of your template it will decide if the editor needs to be included or not."
Reference: Templates in Joomla! 1.5 - Part 1
http://www.joomla.org/component/option, ... ,33/p,210/* remove since the code will be add within header function already.
Code:
<meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
* [optional] Add this line of code if you are using mootools within your template, such as "drop down panel"
Code:
// Load the mootools framework
<?php JHTML::_('behavior.mootools'); ?>
* [doubt] Add system default css
Code:
<link rel="stylesheet" href="templates/system/css/general.css" type="text/css" />
* Add the following css to display tooltips's background
Code:
/* Tooltips */
.tool-tip {
float: left;
background: #ffc;
border: 1px solid #D4D5AA;
padding: 5px;
max-width: 200px;
}
.tool-title {
padding: 0;
margin: 0;
font-size: 100%;
font-weight: bold;
margin-top: -15px;
padding-top: 15px;
padding-bottom: 5px;
background: url(../../system/images/selector-arrow.png) no-repeat;
}
.tool-text {
font-size: 100%;
margin: 0;
}
* [optional] Add this line of code to display system message, such as "Item successfully saved." after you done w/ edit at front-end.
Code:
<jdoc:include type="message" />
* replace
Code:
mosCountModules('xxx')
with
Code:
$this->countModules('xxx')
* replace
Code:
mosLoadModules('xxx', #);
with
Code:
<jdoc:include type="modules" name="xxx" style="" />
# number should switch to according text value from the following list and put into style quote.
0 = table (default)
1 = horz
-1 = raw
-2 = xhtml
-3 = rounded
Reference:
http://help.joomla.org/content/view/1565/155/* replace
Code:
mosMainbody();
with
Code:
<jdoc:include type="component" />
* replace
Code:
$id = mosGetParam( $_REQUEST, 'xxx', ooo );
with
Code:
$id = JRequest::getVar( 'xxx', ooo );
xxx is the name of variable you are request, and ooo is the default value you'll assign when you can't find the value.
getCmd:
Fetches and returns a given filtered variable. The cmd filter only allows the characters [A-Za-z0-9.-_]. This is currently only a proxy function for getVar().
getInT, getFloat, ... etc.
Reference:
http://api.joomla.org/Joomla-Framework/ ... quest.html* replace
Code:
mosPathway();
with
Code:
<jdoc:include type="module" name="breadcrumbs" />
* to get the base path
Code:
<?php echo JURI::base(); ?>
CSS Part* Joomla 1.5 appended the suffix "_menu" to the class for menu module, so you need change your css too.
For example, Joomla 1.0 use "moduletable", you need to add "moduletable_menu" with the same css properties to your css.
* Rename template_css.css to template.css and change the path in index.php and other files that applied.
"We also changed the naming of the master css file to template.css instead of template_css.css"
* media="print" css
You need to add the css include into the component.php file.
Reference:
http://forum.joomla.org/index.php/topic ... #msg961807XML Part* replace
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
with
Code:
<?xml version="1.0" encoding="utf-8"?>
* change
Code:
<install type="template" version="#">
to 1.5.0
* replace
Code:
mosinstall
with
Code:
install
* add positions xml according to those positions you used at your template.
Code:
<positions>
<position>top</position>
...
<position>user6</position>
</positions>
* add parameters according to your need
INI PartIf you are going to use Joomla 1.5 template new feature, changing template parameter at back-end, you need to create a "params.ini".
To config the parameters at back-endYou can remove those hard coded variable and specify those variables in the xml file and also created a ini file.
To retrieved those variables at index.php page.
Code:
$this->params->get("name", "default");
I didn't update the attachment file, so it might be out of date!