Modifying "look" of a module
Posted: Fri Feb 22, 2008 2:58 am
I found a module that I'd like to add to my Joomla Site, but there are are three things that I'd like to see changed, but not being a coder, I'm having a hard time with it and the original coder is non-contactable. Hoping that someone here could help me out.
The module is called Holiday Greetings and can be downloaded here: http://media.wiley.com/product_ancillar ... 20Code.zip . It's in the chapter5 directory.
Two of the problems have to do with the amount of length space usage that the module uses up in the menu.
1) There's quite a bit of blank space between the display of the date and the greeting messages. I can't seem to tell where there might be carriage returns or line feeds causing this. Is it possible to reduce this "dead" space?
2) There's a configurable parameter called greeting, which can be changed in the module, set in the modules ares of the administrator section in Joomla. If this is left blank, the module will display a 0. Can this be fixed in the code?
Finally an asthetic change.
3) The text being displayed does have the option of being bolded, but is still rather plain. I'd like to be able to set the different text lines being display to separate colors (bypassing any style sheets in effect). For Example, the date line would be red, while the Welcome! would be green. What would be the code to implement this?
Any help would be appreciated. Code for the display page pasted below:
The module is called Holiday Greetings and can be downloaded here: http://media.wiley.com/product_ancillar ... 20Code.zip . It's in the chapter5 directory.
Two of the problems have to do with the amount of length space usage that the module uses up in the menu.
1) There's quite a bit of blank space between the display of the date and the greeting messages. I can't seem to tell where there might be carriage returns or line feeds causing this. Is it possible to reduce this "dead" space?
2) There's a configurable parameter called greeting, which can be changed in the module, set in the modules ares of the administrator section in Joomla. If this is left blank, the module will display a 0. Can this be fixed in the code?
Finally an asthetic change.
3) The text being displayed does have the option of being bolded, but is still rather plain. I'd like to be able to set the different text lines being display to separate colors (bypassing any style sheets in effect). For Example, the date line would be red, while the Welcome! would be green. What would be the code to implement this?
Any help would be appreciated. Code for the display page pasted below:
Code: Select all
<?php
/**
* @version $Id: mod_holidaygreetings.php 5203 2006-09-27 02:45:14Z JinxDanr $
* @package Joomla
* @copyright Copyright (C) 2007 Dan Rahmel. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* This is a module to display a holiday greetings on the proper day.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<div><small>
<?php
echo JText::_( '<p>Today is ');
echo( date("l, F dS Y.") . '</p>' );
?>
</small></div>
<div>
<?php
$myGreeting = $params->get('greeting', 0);
$boldSetting = $params->get('boldgreeting', 0);
if ($boldSetting == 1) {
$bb = "<b>";
$be = "</b>";
} else {
$bb = "";
$be = "";
}
$curDay = date("d");
$curMonth = date("m");
$db =& JFactory::getDBO();
$query = "SELECT *" .
"\n FROM jos_greetings" .
"\n WHERE holidayMonth = " .
intval($curMonth) . " and " .
"holidayDay = " . intval($curDay);
$db->setQuery($query);
$holidays = $db->loadObjectList();
if(count($holidays)) {
foreach ($holidays as $holiday) {
echo '<p>' . $bb . JText::_($holiday->greeting) . $be . '</p>';
}
echo '<p>' . JText::_( $myGreeting) . '</p>';
} else {
echo '<p>' . $bb . JText::_( 'Welcome!') . $be . '</p>';
}
?>
</div>