== Joomla 1.5 Templates ==
=== Upgrading your index.php file ===
For templates built for Joomla 1.0.x, you must change a few things for them to work under Joomla 1.5. This is a non-exhaustive list of things to change:
# Replace _VALID_MOS with _JEXEC. For example: //defined( "_VALID_MOS" ) or die( "Restricted access." );
defined( "_JEXEC" ) or die( "Restricted access." );
# Replace $mosConfig_absolute_path with JURI::base(). For example:
//include_once($mosConfig_absolute_path . '/mylib.php');
include_once(JURI::base() . '/mylib.php');
# Replace $mosConfig_live_site with $mainframe->getCfg( 'live_site' ) or JURI::base(). For example:
My Site
My Site
# Replace fixed strings with translatable strings. For example: //echo 'Welcome';
echo JText::_( 'Welcome' );
# Replace calls to mosGetParam() with calls to JRequest::getVar(). For example:
//$id = mosGetParam( $_REQUEST, 'id', 0 );
$id = JRequest::getVar( 'id', 0 );
# Replace mosShowHead(); with . For example:
# Replace mosMainBody() with
# Replace mosLoadModules( $position_name, $style ); with . For example:
//or
# Declare variable $cur_template before you start using it. For example: $cur_template = JRequest::getVar( 'template', $mainframe->getTemplate(), 'default', 'string' );
=== Syntax for Reengineered Objects and Methods ===
^ Object/Method ^ Joomla 1.0.x ^ Joomla 1.5 ^ Note ^
| Access restriction | | | |
| Header | ; | | |
| Main body | or | | |
| Module | | or | |
| Site name | | getCfg('sitename');?> | This new method works for all configuration.php parameters |
| Base URL | | or getCfg( 'live_site' ); ?> | |
| Base path | | | |
| Base path | | | |
| Base path | | | |
| Root path | | | Base path, irrespective of site, administrator, or installation. |
| Link to Home | Home | Home | |