1
mixmaster
Block Title
  • 2005/1/22 13:19

  • mixmaster

  • Just popping in

  • Posts: 28

  • Since: 2005/1/21


Is it possible to change the block.title with an image, whereby each block has a different image? For example, replacing the block title "Recent News" with an image, or "Big Story" with an image.
I was able to do this with module titles by changing the corresponding template file, but I'm not sure how to do the same thing with block titles. Any pointers would be appreciated.

2
Antoine
Re: Block Title
  • 2005/1/22 13:29

  • Antoine

  • Friend of XOOPS

  • Posts: 112

  • Since: 2004/11/14


The Block titles to be displayed are edited using the blocks admin. Inputted titles are most probably stripped of any html code so I think it would require some code hacking to get this done.

3
mixmaster
Re: Block Title
  • 2005/1/22 13:39

  • mixmaster

  • Just popping in

  • Posts: 28

  • Since: 2005/1/21


Thanks for the pointer. Any suggestions on how to go about doing this? Where and what do I have to hack? If anyone has a solution to this please let me know. Cheers.

4
carnuke
Re: Block Title
  • 2005/1/22 13:40

  • carnuke

  • Home away from home

  • Posts: 1955

  • Since: 2003/11/5


The formatting of block titeles is controlled in the style.css of the theme. This is the place to make specific changes.

To help users without much experience, I suggest using an application like topstyle css editor. Very useful because it gives you as close as possible WYSIWYG output. Search for this on google, or download it from my pesonal site in link below.

Richard

5
mixmaster
Re: Block Title
  • 2005/1/22 13:48

  • mixmaster

  • Just popping in

  • Posts: 28

  • Since: 2005/1/21


Thanks, I'll see what I can do. I'll post an update as soon as I have something. Cheers.

6
Antoine
Re: Block Title
  • 2005/1/22 14:34

  • Antoine

  • Friend of XOOPS

  • Posts: 112

  • Since: 2004/11/14


Editing the style.css would not allow you to specify an image per block, only one image to be used with all blocks. If you want to do something in a theme dependent way, but still have some flexibility (I assume you want a different image per block) I'd suggest, using the default theme as an example, to change theme_blockleft.html and them_blockright.html to read:

<div class="blockTitle"><img src="<{$xoops_imageurl}>/<{$block.title|replace:" ":"_"}>_image.jpg"><{$block.title}></div>
<
div class="blockContent"><{$block.content}></div>


Then you'd place all images in the directory of the theme you are using and name them blocktitle_image.jpg, where you would replace blocktitle with the title of the block, replacing spaces with an _.

Be advised however that every block you now display should now have a corresponding image or a broken image link will be displayed.

There is a possiblilty to include PHP code into the template to check wether an image exists but this would become so cumbersome you'd be better off adding this block icon functionality to the XOOPS core.

7
mixmaster
Re: Block Title
  • 2005/1/22 14:38

  • mixmaster

  • Just popping in

  • Posts: 28

  • Since: 2005/1/21


Ok, I have a good idea of what to do but I'm not sure how to implement it. Basically, I want to associate an image e.g.{$block.image} to a block, similar to how {$block.title} is associated to each block title. Simple enough, but I don't know where to start. I'm sure someone out there know how to do this.

8
mixmaster
Re: Block Title
  • 2005/1/22 14:41

  • mixmaster

  • Just popping in

  • Posts: 28

  • Since: 2005/1/21


Thanks Antoine, I'm going to try it and see how it turns out. Cheers.

9
carnuke
Re: Block Title
  • 2005/1/22 14:49

  • carnuke

  • Home away from home

  • Posts: 1955

  • Since: 2003/11/5


Try creating different classes for each block, then assign uniquie images to each

10
Antoine
Re: Block Title
  • 2005/1/22 15:10

  • Antoine

  • Friend of XOOPS

  • Posts: 112

  • Since: 2004/11/14


Yes I've already looked into that option but it would involve changes into too many XOOPS core components, like /kernel/block.php, /modules/system/admin/blocksadmin/* and /install/*, to make it a quick solution.

If it would even be desirable to make it a theme independent feature that is. It could be gracefully implemented in a theme if one would write a custom Smarty function that'd do something like PHP's file_exists() function.

And yes arguably you could have smarty generate a class attribute per block based on the title, but if anything that would only serve to make things more complicated and not neccesarily more consistent, since the site logo has been hard-coded into the theme.html file too, rather than invoking it based on a CSS.

EDIT: Lol @ XoopsProtector thinking I'm trying to comment out an SQL statement and adding a closing comment!*/

Login

Who's Online

214 user(s) are online (143 user(s) are browsing Support Forums)


Members: 0


Guests: 214


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