Also See Introduction Module Description Module Features Quick Start Guide Compatibility Module Installation Module Configuration Downloads Change History CSS Styling JavaScript Effects SOBI Clones Warranty & Support Sample Screen Shots Demo Sites Upgrading Languages Tips and Tricks Module Template
| Module Template
mod_sobi2simplefeatured is compatible with Joomla v1.5.x Module Output Templates. Module Output Templates control how modules output their HTML. You can create you own custom Module Output Template. You can also create Module Layout Overrides in your Site Template
You will need a basic knowledge of PHP programming, to make a 'simple' custom Module Output Template, (such as changing Changing Entry fields output order).
You need a mid-level knowledge of PHP programming, to make 'complex' custom Module Output Templates, (such as adding a new class selector to every nth <div class="entry"> for Displaying Entries 'side-by-side')
To create a custom Module Output Template
- Make a copy of the files;
{MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/default.php, and {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/default.helper.php
and save the copies in {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/
giving the copies a new Template name, such as 'my_custom_template' so that in addition to the files; {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/default.php, and {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/default.helper.php
you now have the files {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/my_custom_template.php, and {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/my_custom_template.helper.php
- Then, go to: Joomla Administrator->Extensions->Module Manager
and edit mod_sobi2simplefeatured
- In the Module configuration, go to Advanced Parameters, and,
select the Template 'my_custom_template' from the drop-down list, and then, save the Module Parameters.
- Edit {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/my_custom_template.php
By editing the php code in {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/my_custom_template.php you can change the order in which module HTML is output. (you will need a basic knowledge of PHP programming to edit this file)
The PHP code included in default.php version 1.03 is shown below;
|
<?php
/**
* @version $Id: default.php 1.0.3
* @package mod_sobi2simplefeatured
* @authorName Mark Smith
* @authorEmail Mark.Smith@iBayIslands.com
* @authorUrl http://UtilaRealEstateCompany.com
* @copyright Copyright (C) 2009 Mark Smith - All rights reserved.
* @license see http://www.gnu.org/copyleft/gpl.html GNU/GPL.
* SOBI2 and mod_sobi2simplefeatured is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
* @Module mod_sobi2simplefeatured.php 20-Jun-2009 Mark Smith
**/
#$my_module->Debug('$var',$var,__FILE__,__CLASS__,__LINE__);
(defined( '_VALID_MOS' ) || defined( '_JEXEC' ) ) || ( trigger_error( 'Restricted access', E_USER_ERROR ) && exit() );
$version_template='v1.0.4'; # Version of this Template file
# Start output Module HTML
# Note: the order of the $my_module->echo statements, is the order of the HTML output
# output HTML for Module Start
# !!IMPORTANT!! do not delete the following line
$my_module->echoHTML_Module_Start($version_template);
# output for PreText content, if required
$my_module->echoPreText();
# output for JavaScript effects Start, if required
# !!IMPORTANT!! if you delete the following line, you also have to delete the line $my_module->getHTML_Effects_End();
$my_module->echoHTML_Effects_Start();
# Output HTML for each Entry
foreach ($entries as $entry){
# output HTML for Entry wrapper start division
$my_module->echoHTML_Entry_Wrapper_Start();
# output HTML for Title, if required
$my_module->echoHTML_Title($entry);
# output HTML for Icon, if required
$my_module->echoHTML_Icon($entry);
# output HTML for Image, if required
$my_module->echoHTML_Image($entry);
# output HTML for Custom Fields, if required
$my_module->echoHTML_CustomFields($entry);
# output HTML for Hits Counter, if required
$my_module->echoHTML_HitsCounter($entry);
# output HTML for Text Link to Entry Details, if required
$my_module->echoHTML_TextLink($entry);
# output HTML for Entry wrapper end division
$my_module->echoHTML_Entry_Wrapper_End();
# End Output HTML for each Entry
}
# Build output for javascript effects End, if required
# !!IMPORTANT!! if you delete the following line, you also have to delete the line $my_module->getHTML_Effects_Start();
$my_module->echoHTML_Effects_End();
# Output HTML for PostText content, if required
$my_module->echoPostText();
# Output HTML for Module Execution Statistics, if required
$my_module->echoHTML_ExecuteStats($start_time,$fileload_time,$start_memory);
# output HTML for Module End
# !!IMPORTANT!! do not delete the following line
$my_module->echoHTML_Module_End();
# End Output Module HTML
?>By changing the order of the
$my_module->echoHTML_name($entry); statements, you will change the order they are output in the Module display.
For Example;
To change the order in which default.php version 1.03 outputs, the 'Hits Counter' and the 'Text Link'
Change the code lines;
# output HTML for Hits Counter, if required
$my_module->echoHTML_HitsCounter($entry);
# output HTML for Text Link to Entry Details, if required
$my_module->echoHTML_TextLink($entry);
To:
# output HTML for Text Link to Entry Details, if required
$my_module->echoHTML_TextLink($entry);
# output HTML for Hits Counter, if required
$my_module->echoHTML_HitsCounter($entry);
Simple eh?
- Edit {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/my_custom_template.helper.php
By editing {MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/my_custom_template.helper.php
you can completely customize every aspect of the HTML output by the module.
(you need a mid-level knowledge of PHP programming to edit this file)
The PHP code included in default.helper.php version 1.03 is shown below;
<?php
/**
* @version $Id: default.php 1.0.2
* @package mod_sobi2simplefeatured
* @authorName Mark Smith
* @authorEmail Mark.Smith@iBayIslands.com
* @authorUrl http://UtilaRealEstateCompany.com
* @copyright Copyright (C) 2009 Mark Smith - All rights reserved.
* @license see http://www.gnu.org/copyleft/gpl.html GNU/GPL.
* SOBI2 and mod_sobi2simplefeatured is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation.
* @Module mod_sobi2simplefeatured.php 20-Jun-2009 Mark Smith
**/
#$this->Debug('$var',$var,__FILE__,__CLASS__,__LINE__);
(defined( '_VALID_MOS' ) || defined( '_JEXEC' ) ) || ( trigger_error( 'Restricted access', E_USER_ERROR ) && exit() );
class mod_sobi2simplefeaturedTemplate extends mod_sobi2simplefeaturedHelper {
var $version_template_helper; # Version of this Helper (set in function constructor)
function mod_sobi2simplefeaturedTemplate($module,$params){
$this->constructor($module,$params);
}
function constructor($module,$params){
$module->version_template_helper='v1.0.3';
parent::constructor($module,$params);
}
function echoHTML_Module_Start($version_template){
# Output HTML for start of Module HTML Output
$this->version_template=$version_template;
if ($this->params->get('EffectEnable')){$this->addHTML_Effect_Head_Tags();}
# Output HTML for start of Module HTML Output
$this->echoHTML_StartStamp();
$this->echoHTML_WrapperStartDiv();
}
function echoHTML_Module_End(){
# echo all HTML for end of Module HTML Output
# End tag for Module Wrapper Division
echo "\n",'</div>';
# End tag for Module HTML Output Stamp
echo "\n",'<!-- End HTML output -->'; # Module HTML Output End Stamp
}
function echoHTML_StartStamp(){
# get HTML Output start Stamp
# return HTML for HTML Output start Stamp
$effects=NULL;
if ($this->params->get('EffectEnable')){
$effects=$this->version_effects_helper ? ' and Effects Helper '.$this->version_effects_helper : NULL;
}
echo "\n",'<!-- Start HTML output with Template ',$this->params->get('template'),' ',$this->version_template,' and Template helper ',$this->version_template_helper.$effects,' -->';
}
function echoHTML_WrapperStartDiv (){
# Output Module HTML start output
echo "\n",'<div class="',$this->module->module,$this->params->get('wrapperclass_sfx'),'">';
}
function echoHTML_Effects_Start(){
# echo javascript effects wrapper start, if required
# return HTML or NULL
if ($this->params->get('EffectEnable')=='SLIDER'){echo $this->getHTML_Effect_Slider_Start();}
if ($this->params->get('EffectEnable')=='FADER'){echo $this->getHTML_Effect_Fader_Start();}
}
function echoHTML_Effects_End(){
# echo javascript effects wrapper end, if required
if ($this->params->get('EffectEnable')=='SLIDER') {echo $this->getHTML_Effect_Slider_End();}
if ($this->params->get('EffectEnable')=='FADER') {echo $this->getHTML_Effect_Fader_End();}
}
function echoHTML_Entry_Wrapper_Start(){
# echo HTML for each Entry wrapper
if ($this->params->get('EffectEnable')){
$style=' style="';
$style.=$this->params->get('EntryBackground') ? "background-color:".$this->params->get('EntryBackground').";" : NULL;
$style.=$this->params->get('EffectHeight') ? "height:".$this->params->get('EffectHeight')."px;" : NULL;
$style.='"';
echo "\n",' <div class="entry"',$style,'>';
}
else echo "\n",' <div class="entry">';
}
function echoHTML_Entry_Wrapper_End(){
# echo HTML for Entry Wrapper End
echo "\n",' </div>';
}
function echoPreText(){
# echo PreText content, if needed
if ($this->params->get('preText')) {echo "\n",'<div class="PreText">',$this->params->get('preText'),"\n",'</div>';}
}
function echoPostText(){
# echo PreText content, if needed
if ($this->params->get('postText')) {echo "\n",'<div class="PostText">',$this->params->get('postText'),"\n",'</div>';}
}
function echoHTML_Title($entry){
# echo Title HTML, if needed
# return html or NULL
if ($this->params->get('displayTitle')=='link'){
echo "\n",' <div class="title"><a href="',$entry['href'],'">',$entry['title'],'</a></div>';
}
elseif ($this->params->get('displayTitle')){
echo "\n",' <div class="title">',$entry['title'],'</div>';
}
}
function echoHTML_Icon($entry){
# echo Icon HTML, if needed
if ($this->params->get('displayIcon')){
if (!$entry['icon']){
# No Icon image file value found by getFieldsData
echo "\n",' <div class="noicon"></div>';
}
elseif ($this->params->get('displayIcon')=='link'){
$url=$this->sobi2_config->liveSite.$this->sobi2_config->imagesFolder.$entry['icon'];
echo "\n",' <div class="icon"><a href="',$entry['href'],'"><img src="',$url,'" alt="',$entry['title'],'" /></a></div>';
}
else {
$url=$this->sobi2_config->liveSite.$this->sobi2_config->imagesFolder.$entry['icon'];
echo "\n",' <div class="icon"><img src="'.$url.'" alt="',$entry['title'],'" /></div>';
}
}
}
function echoHTML_Image ($entry){
# echo Image HTML, if needed
if ($this->params->get('displayImage')){
if (!$entry['image']){
# No Icon image file value found by getFieldsData
echo "\n",' <div class="noimage"></div>';
}
elseif ($this->params->get('displayImage')=='link'){
$url=$this->sobi2_config->liveSite.$this->sobi2_config->imagesFolder.$entry['image'];
echo "\n",' <div class="image"><a href="',$entry['href'],'"><img src="',$url,'" alt="',$entry['title'],'" /></a></div>';
}
else {
$url=$this->sobi2_config->liveSite.$this->sobi2_config->imagesFolder.$entry['image'];
echo "\n",' <div class="image"><img src="'.$url.'" alt="',$entry['title'],'" /></div>';
}
}
}
function echoHTML_CustomFields($entry){
# echo Custom Fields HTML, if needed
if ($this->custom_field_ids){
echo "\n",' <div class="customfields">'; # Start Custom Fields wrapper division
foreach ($this->custom_field_ids as $custom_field){
if ($this->params->get('displayCustomFieldLabels')){
echo "\n",' <div class="C',$custom_field,'"><span class="label">',$entry['fieldLabel'.$custom_field],'</span><span class="separator">',$this->params->get('LabelSeparator'),'</span><span class="data">',$entry['fieldId'.$custom_field],'</span></div>';
}
else
echo "\n",' <div class="C'.$custom_field.'">',$entry['fieldId'.$custom_field],'</div>';
}
echo "\n",' </div>'; # End Custom Fields wrapper division
}
}
function echoHTML_HitsCounter($entry){
# echo Hits Counter HTML, if needed
if ($this->params->get('displayHits')){
echo "\n",' <div class="hits"><span class="text">',$this->params->get('HitsText'),'</span><span class="value">',$entry['hits'],'</span></div>';
}
}
function echoHTML_TextLink($entry){
# echo Text Link HTML, if needed
if ($this->params->get('displayLink')){
echo "\n",' <div class="link"><a class="link" href="',$entry['href'],'"><span class="text">',$this->params->get('LinkText'),'</span></a></div>';
}
}
function echoHTML_ExecuteStats($start_time,$fileload_time,$start_memory){
# Build HTML for Module Execution Statistics
# return html or NULL
if ($this->params->get('displayExecuteStats')){
echo "\n",'<div class="statistics">';
echo '<span class="time">File Load Time = ',round($fileload_time-$start_time,3),' seconds, </span>';
echo '<span class="time">Execution Time = ',round(microtime(true)-$fileload_time,3),' seconds, </span>';
echo '<span class="time">Total Time = ',round(microtime(true)-$start_time,3),' seconds, </span>';
echo '<span class="memory">Memory Used = ',number_format(memory_get_usage()-$start_memory),' bytes, </span>';
echo '<span class="queries">SQL Query Count = ',$this->module_sql_query_count,'</span>';
echo '</div>';
}
}
}
?>By changing PHP code in the functions;
function echoHTML_Name
() {... PHP code ...}you can completely change the HTML output for each element in the Module display.
Note:
If more than one copy/instance of mod_sobi2simplefeatured is published on the same 'page', then mod_sobi2simplefeatured will load/use the
{MyJoomlaInstallation}/modules/mod_sobi2simplefeatured/tmpl/
template.helper.php file associated with the first copy/instance of mod_sobi2simplefeatured loaded for that 'page' for all other copies/instances on that 'page'. Also refer
Bug and Error Report -
[CONFIRMED] only one 'template'.helper.php file is loaded