Yep! Now that I've had some sleep my post might make sense!
The following hack will allow you to display the output of the random quote module (found at
ModsCentral) in the banner area of your site (but I'm sure it can be used to show it wherever you like)... basically it takes the random quote out of a block. It's actually more of a core hack than theme hack I guess.
Since I don't use banners at my site, I've used that area to build the quote, but I'm sure it can be hacked to show both.
In
header.php you'll find this code, starting around line 79:
// show banner?
if ($xoopsConfig['banners'] == 1) {
$xoopsTpl->assign('xoops_banner', xoops_getbanner());
} else {
$xoopsTpl->assign('xoops_banner', ' ');
}
Since I have banners off, I modified the else condition as follows:
} else {
$block = array();
$result = $xoopsDB->query("SELECT count(*) FROM ".$xoopsDB->prefix("citas"));
list($total_rows) = $xoopsDB->fetchRow($result);
$x = rand(1,$total_rows);
$result = $xoopsDB->query("SELECT texto, autor FROM ".$xoopsDB->prefix("citas")." WHERE id=".$x);
list($texto, $autor)= $xoopsDB->fetchRow($result);
if ($autor) { $autor2 = " -- ".$autor; }
else { $autor2 = ""; }
$xoopsTpl->assign('xoops_banner', "$texto $autor2");
}
The above will then spit out the random quote, with formatting based on
td#headerbanner in your theme's css file. It will look something like this:
Have no fear of perfection; you'll never reach it. -- Salvador Dali
if ($autor) { $autor2 = " -- ".$autor; }
else { $autor2 = ""; }
You might be wondering why I have included the above. I use the quote module not only for quotes, but also for small bits of information (for example, the date that a particular event occured). When one of these is displayed, there really isn't an author (autor) associated with it. Therefore I don't want the
-- to be displayed after the quote/texto information.
Also, if you want to change the formatting of the quote or author, the easiest way to do this is modify
$xoopsTpl->assign('xoops_banner', "$texto $autor2");, for example:
$xoopsTpl->assign('xoops_banner', "
$texto$autor2");
I'm pretty new to php, so there might be a better way to do this, but the above seems to work!
Brad