I've just been working on this hack tonight, and it seems to be working fine, so I thought I'd pass it along for others to try (and hopefully make it better!).
This hack, as I have it implemented, automatically replaces all of the titles in the center/center blocks with a corresponding graphic. If the graphic does not exist, it just prints out the block title in text format (ie. no broken image to worry about). All this really means is you can add fancy graphic titles to all of your center/center blocks without too much hassle.
For this to work, you need to modify
header.php and
theme_blockcenter_c.html.
header.phpAround line 185 you'll see this code:
case XOOPS_CENTERBLOCK_CENTER:
A few lines down from it, you'll see this:
$xoopsTpl->append('xoops_ccblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent));
Just before the
$xoopsTpl line, add this code:
// title hack
$imgttl = $block_arr[$i]->getVar('title');
// replace spaces with underscores
$imgttl = str_replace(" ", "_", $imgttl);
// remove non-alphanumeric characters
$imgttl = preg_replace("(W)", "", $imgttl);
// convert to lower case
$imgttl = mb_convert_case($imgttl, MB_CASE_LOWER, "UTF-8");
// append image format
$imgttl = $imgttl.".gif";
// build paths
$imgpath = XOOPS_ROOT_PATH.'/images/'.$imgttl;
$imgurl = XOOPS_URL.'/images/'.$imgttl;
// check for file
if (file_exists($imgpath)) {
$ttl_img = $imgurl;
}
else { $ttl_img = ""; }
Next, change the
$xoopsTpl line to this:
$xoopsTpl->append('xoops_ccblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'ttl_img' => $ttl_img));
theme_blockcenter_c.htmlChange this code:
<{$block.title}>
To this:
<{if $block.ttl_img}>
<img src="<{$block.ttl_img}>" alt="<{$block.title}>" title="<{$block.title}>">
<{else}>
<{$block.title}>
<{/if}>
After making these changes, you shouldn't see any difference in your center/center blocks unless you upload graphics into your XOOPS "/images" folder.
Make sure you change
$imgttl = $imgttl.".gif"; to match the extension of the images you will be uploading (eg: .png or .jpg).
The graphic names should all be lower case, and have spaces replaced with underscores. Examples:
Block Title: What's New
Corresponding Graphic: whats_new.gif
Block Title: Recent Discussions
Corresponding Graphic: recent_discussions.gif
Block Title: News!!!!
Corresponding Graphic: news.gif
Block Title: tHe gNU PrOjeCT
Corresponding Graphic: the_gnu_project.gif
Brad