11
Nootje
Re: auto-replace block title with graphic
  • 2004/3/16 21:36

  • Nootje

  • Just popping in

  • Posts: 15

  • Since: 2004/3/16


Quote:

WarDick wrote:
I need some help with this hack.

This line causes a blank screen.
$imgttl = mb_convert_case($imgttl, MB_CASE_LOWER, "UTF-8");

Any ideas?


I just had the same problem on my comp. And it seems to be Apache. I fixed it by going to the php.ini file and uncommenting the following line:

;extension=php_mbstring.dll

Then restarted Apache and it worked :)

Nice hack btw BradM

12
IShades
Re: auto-replace block title with graphic
  • 2004/3/23 18:50

  • IShades

  • Just popping in

  • Posts: 96

  • Since: 2004/2/20


Where exactly is the php.ini file to edit at?

13
hawkeyegop
Re: auto-replace block title with graphic
  • 2004/12/10 23:48

  • hawkeyegop

  • Just popping in

  • Posts: 83

  • Since: 2004/9/18


Brad,

This hack is awesome, thanks so much!

Chris

14
CiberEspia
Re: auto-replace block title with graphic

thank you for the hack...very cool!

15
LazyBadger
Re: auto-replace block title with graphic

Quote:

BradM wrote:
I could swear that about a year or so ago I came across a site that generated instant title graphics
...
Of course, no matter what I tried in Google, nothing came up, so I'm afraid I'm not being very helpful here.

You have go tohttp://www.aditus.nu/jpgraph/index.php
and with JpGraph (and installed GD on site) you can create cool effects on site - transform text into graphics on the fly (with any avaliable on host font), use vertical alignment for result text...
Ihae a dream to see theme, which was powered with it (I tried to create theme with vertical blocktitle to left-right blocks)

16
hawkeyegop
Re: auto-replace block title with graphic
  • 2005/4/17 22:56

  • hawkeyegop

  • Just popping in

  • Posts: 83

  • Since: 2004/9/18


Quote:

BradM wrote:
I'm trying to figure out a way to make these titles theme-specific. I'm not sure how <{$xoops_imageurl}> (usually embedded in HTML) can translate into something usable in PHP code.

Also, is there a path equivalent to $xoops_imageurl?


Brad


Hello,

Several months ago I found this hack and I love it. BradM mentioned that he was trying to figure out how to make this hack theme-specific. Does anyone have any ideas?

Thanks,

Chris

17
middleton
Re: auto-replace block title with graphic (update!)
  • 2006/12/31 5:02

  • middleton

  • Just popping in

  • Posts: 30

  • Since: 2006/12/21


Here I was trying to come up with this hack tonight, with not much luck. But after a search here, I realized I posted the same hack a couple of years ago under my old account (BradM)! I think I've lost some brain cells.

Anyway, I'm using XOOPS 2.0.16 and here's how to implement this old hack. Of course, back up the necessary files before modifying them!!

Step 1: edit /class/theme_blocks.php
In function buildBlock, just before the line $block = array(, add the following code:
/* hack to auto-replace block titles with graphics */
// get the block title
$imgttl $xobject->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($imgttlMB_CASE_LOWER"UTF-8");
// append image format
$imgttl $imgttl.".gif";
// build paths
$imgpath XOOPS_THEME_PATH.'/THEMEDIR/images/'.$imgttl;
$imgurl XOOPS_THEME_URL.'/THEMEDIR/images/'.$imgttl;
// check for file
if (file_exists($imgpath)) {
    
$ttl_img $imgurl;
}
else { 
$ttl_img ""; }
/* end hack */

Here I'm using the path/url to a single theme directory ("THEMEDIR"). There must be a way to stick a XOOPS variable in here to make this applicable to all themes, but I don't know what it is.

Next, under 'lastmod' => $xobject->getVar( 'last_modified' ), add the following line:
'ttl_img' => $ttl_img,


Step 2: edit /themes/THEMEDIR/theme.html
Put the following code where ever you would like to activate this switch. I only have it functioning on the right-hand column, so I've put this code where the right-hand blocks are generated. You need to replace <{$block.title}> with the following:
<{if $block.ttl_img}>
    <
img src="<{$block.ttl_img}>" alt="<{$block.title}>" title="<{$block.title}>">
<{else}>
    <{
$block.title}>
<{/if}>

Step 3: upload your title graphics (in GIF format, all lower case) into /themes/THEMEDIR/images/.
Name them to match your titles, replacing spaces with underscores. For example, "User Menu" becomes "user_menu.gif". If the script can't find the file, it'll just add the text version.

That should do it. For some reason, this doesn't work on anything with an apostrophe (such as "Who's Online") -- and I cannot figure out why. I think XOOPS converts the apostrophe to unicode (or whatever it's called) so maybe that's why?

Brad

Login

Who's Online

230 user(s) are online (157 user(s) are browsing Support Forums)


Members: 0


Guests: 230


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits