J1.5

Difference between revisions of "New features introduced in templates"

From Joomla! Documentation

m (1 revision(s))
(Made page a bit prettier!)
Line 1: Line 1:
 
A summary of new features introduced in Joomla! 1.5 templates:
 
A summary of new features introduced in Joomla! 1.5 templates:
  
1. '''Model, View, Controller''': This structure has been implemented in Joomla! 1.5, separating out logic, data and view of data. This means that the HTML, CSS and other code used to display Joomla! (to the browser or other device) is now completely separate from the Joomla! logic and is contained entirely within the templating system. This gives you greater control over how you wish to display the data, without having to access (hack!) core Joomla! code.
+
; '''Model View Controller (MVC)'''
 +
: This structure has been implemented in Joomla! 1.5, separating out logic, data and view of data. This means that the HTML, CSS and other code used to display Joomla! (to the browser or other device) is now completely separate from the Joomla! logic and is contained entirely within the templating system. This gives you greater control over how you wish to display the data, without having to access (hack!) core Joomla! code.
  
2. '''Template positions''': The positions used in a template are now declared in templateDetails.XML.  
+
; '''Template positions'''
e.g.
+
: The positions used in a template are now declared in ''templateDetails.xml''. For example,
 +
<source lang="xml">
 
<positions>                         
 
<positions>                         
 
<position>top</position>             
 
<position>top</position>             
 
<position>left</position>         
 
<position>left</position>         
 
</positions>
 
</positions>
 +
</source>
 +
; '''Joomla version'''
 +
: The version number is now declared in the template.  For example, ''<install version="1.5" type="template">'' replaces 1.0.x ''<mosinstall type="template">''.
  
3. '''Joomla version''': The version number is now declared in the template,
+
; '''Template parameters'''
e.g. <install version="1.5" type="template"> replaces 1.0.x <mosinstall type="template">
+
: Parameters may be defined in your template. These are declared in ''templateDetails.xml''. Parameter default values can be set in ''params.ini'', which is also referenced in ''templateDetails.XML'' as a template <file>. The parameters can be set in the Administrator Template Manager and also only the fly using the template's Javascript.
  
4. '''Template parameters''': Parameters may be defined in your template. These are declared in templateDetails.XML. Parameter default values can be set in params.ini, which is also referenced in templateDetails.XML as a template <file>. The parameters can be set in the Administrator Template Manager and also only the fly using the template's Javascript.
+
; '''Template overrides'''
 +
: The default system chrome ('views') for any module or component can now be overridden by the template. Default system chrome for each module and component can now be found in directories ''modules/mod_modulename/tmpl'' and ''components/com_componentname/views/layout/tmpl''. The pagination chrome can also be overridden in ''pagination.php''.
  
5. '''Template overrides''': The default system chrome ('views') for any module or component can now be overridden by the template. Default system chrome for each module and component can now be found in directories modules/mod_modulename/tmpl and components/com_componentname/views/layout/tmpl. The pagination chrome can also be overridden in pagination.php.
+
; '''Objects and Methods'''
 +
: The Joomla! 1.5 framework has been re-engineered and now includes the JApplication layer, which contains a number of objects and methods you can reference from the template ''index.php''.  For example, ''<jdoc:include type="head" />'' replaces the 1.0.x ''<?php mosShowHead(); ?>;'', ''<?php echo $mainframe->getCfg('sitename');?>'' replaces the 1.0.x ''<?php echo $mosConfig_sitename; ?>'' [N.B. This new method works for all ''configuration.php'' parameters], ''<?php // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); ?>'' replaces the 1.0.x ''<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); ?>'', ''<?php echo JURI::base();;?>'' replaces the 1.0.x ''<?php echo $mosConfig_live_site; ?>''.
  
6. '''Objects and Methods''': The Joomla! 1.5 framework has been re-engineered and now includes the JApplication layer, which contains a number of objects and methods you can reference from the template index.php,
+
; '''Module Positions'''
e.g.  
+
: There is a new way of checking which module positions have content to display on the current page. This logic can be used for collapsible columns (e.g. collapse the left or right column if no content is present). The 1.0.x ''mosCountModules'' function has been replaced by the ''$this->countModules'' and conditions have been added: you can now use '+', '-', 'or' or 'and', e.g. ''if ($this->countModules('left or right') == 1)''.
<jdoc:include type="head" /> replaces the 1.0.x <?php mosShowHead(); ?>;
 
<?php echo $mainframe->getCfg('sitename');?> replaces the 1.0.x <?php echo $mosConfig_sitename; ?> [N.B. This new method works for all configuration.php parameters];
 
<?php // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); ?> replaces the 1.0.x <?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); ?>
 
<?php echo JURI::base();;?> replaces the 1.0.x <?php echo $mosConfig_live_site; ?>
 
  
7. '''Module Positions''': There is a new way of checking which module positions have content to display on the current page. This logic can be used for collapsible columns (e.g. collapse the left or right column if no content is present). The 1.0.x 'mosCountModules' function has been replaced by the '$this->countModules', and conditions have been added: you can now use '+', '-', 'or' or 'and', e.g. if($this->countModules('left or right') == 1).
+
; '''Template file structure'''
 +
: The template directory and file structure has been expanded to include all of the above.
  
8. '''Template file structure''': The template directory and file structure has been expanded to include all of the above.
+
; '''Accessibility and Standards'''
 +
: Using template overrides, it is possible to create tableless Joomla! The new parameters and overrides encourage improvements in web standards, accessbility, search engine optimisation (SEO) (source ordering and markup), language (left to right support) and browser optimisation (browser-dependent CSS).
  
9. '''Accessibility and Standards''': Using template overrides, it is possible to create table-less Joomla! The new parameters and overrides encourage improvements in web standards, accessbility, SEO optimsation (source ordering and markup), language (left to right support) and browser optimisation (browser-dependent CSS).
+
; '''Default system template'''
 
+
: The system template (in the ''/templates'' directory) has been expanded to include more CSS files and a standard ''modules.php'' (module chrome) and ''component.php'' (component chrome). You can include some of the default CSS files in your template.  For example,
10. '''Default system template''': The system template (in the /templates directory) has been expanded to include more CSS files and a standard modules.php (module chrome) and component.php (component chrome).
+
<source lang="html4strict">
You can include some of the default CSS files in your template,  
 
e.g.
 
 
<link rel="stylesheet" href="templates/system/css/system.css" type="text/css" />  
 
<link rel="stylesheet" href="templates/system/css/system.css" type="text/css" />  
 
<link rel="stylesheet" href="templates/system/css/general.css" type="text/css" />  
 
<link rel="stylesheet" href="templates/system/css/general.css" type="text/css" />  
 +
</source>
  
11. '''Additional Javascript''': there are some additional Javascript libraries available for use in your template.  
+
; '''Additional Javascript'''
e.g.
+
: there are some additional Javascript libraries available for use in your template. For example,
 +
<source lang="html4strict">
 
<script type="text/javascript" src="media/system/js/mootools.js"></script>  
 
<script type="text/javascript" src="media/system/js/mootools.js"></script>  
 
<script type="text/javascript" src="media/system/js/caption.js"></script>
 
<script type="text/javascript" src="media/system/js/caption.js"></script>
These are included in <jdoc:include type="head" />
+
</source>
 +
: These are included in ''<jdoc:include type="head" />''
  
12. '''Errors handling''': More default error pages are included in the system template (403.php and 500.php) and a new error message call has been introduced, which must be referenced in your template by <jdoc:include type="message" />
+
; '''Error handling'''
 +
: More default error pages are included in the system template (''403.php'' and ''500.php'') and a new error message call has been introduced, which must be referenced in your template by ''<jdoc:include type="message" />''
 
[[Category:Templates]]
 
[[Category:Templates]]

Revision as of 11:19, 24 January 2008

The "J1.5" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

A summary of new features introduced in Joomla! 1.5 templates:

Model View Controller (MVC)
This structure has been implemented in Joomla! 1.5, separating out logic, data and view of data. This means that the HTML, CSS and other code used to display Joomla! (to the browser or other device) is now completely separate from the Joomla! logic and is contained entirely within the templating system. This gives you greater control over how you wish to display the data, without having to access (hack!) core Joomla! code.
Template positions
The positions used in a template are now declared in templateDetails.xml. For example,
<positions>                        
<position>top</position>             
<position>left</position>         
</positions>
Joomla version
The version number is now declared in the template. For example, <install version="1.5" type="template"> replaces 1.0.x <mosinstall type="template">.
Template parameters
Parameters may be defined in your template. These are declared in templateDetails.xml. Parameter default values can be set in params.ini, which is also referenced in templateDetails.XML as a template <file>. The parameters can be set in the Administrator Template Manager and also only the fly using the template's Javascript.
Template overrides
The default system chrome ('views') for any module or component can now be overridden by the template. Default system chrome for each module and component can now be found in directories modules/mod_modulename/tmpl and components/com_componentname/views/layout/tmpl. The pagination chrome can also be overridden in pagination.php.
Objects and Methods
The Joomla! 1.5 framework has been re-engineered and now includes the JApplication layer, which contains a number of objects and methods you can reference from the template index.php. For example, <jdoc:include type="head" /> replaces the 1.0.x <?php mosShowHead(); ?>;, <?php echo $mainframe->getCfg('sitename');?> replaces the 1.0.x <?php echo $mosConfig_sitename; ?> [N.B. This new method works for all configuration.php parameters], <?php // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); ?> replaces the 1.0.x <?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); ?>, <?php echo JURI::base();;?> replaces the 1.0.x <?php echo $mosConfig_live_site; ?>.
Module Positions
There is a new way of checking which module positions have content to display on the current page. This logic can be used for collapsible columns (e.g. collapse the left or right column if no content is present). The 1.0.x mosCountModules function has been replaced by the $this->countModules and conditions have been added: you can now use '+', '-', 'or' or 'and', e.g. if ($this->countModules('left or right') == 1).
Template file structure
The template directory and file structure has been expanded to include all of the above.
Accessibility and Standards
Using template overrides, it is possible to create tableless Joomla! The new parameters and overrides encourage improvements in web standards, accessbility, search engine optimisation (SEO) (source ordering and markup), language (left to right support) and browser optimisation (browser-dependent CSS).
Default system template
The system template (in the /templates directory) has been expanded to include more CSS files and a standard modules.php (module chrome) and component.php (component chrome). You can include some of the default CSS files in your template. For example,
<link rel="stylesheet" href="templates/system/css/system.css" type="text/css" /> 
<link rel="stylesheet" href="templates/system/css/general.css" type="text/css" />
Additional Javascript
there are some additional Javascript libraries available for use in your template. For example,
<script type="text/javascript" src="media/system/js/mootools.js"></script> 
<script type="text/javascript" src="media/system/js/caption.js"></script>
These are included in <jdoc:include type="head" />
Error handling
More default error pages are included in the system template (403.php and 500.php) and a new error message call has been introduced, which must be referenced in your template by <jdoc:include type="message" />