Is there anyway to use an image as the title for a block?

Comments

fumbling’s picture

Since the block title is optional and can be left blank, are you sure you need one at all? Could you could just place the image at the top of the content that you enter in the body field of the add-a-block page when you create it? Anyway, just a thought, best of luck.

Drupalot.com - ask & answer Drupal questions

raymondfranco’s picture

not quite sure what u mean add-a-block?? http://www.advertising-space.co.za/onQ/a.jpg take a look at the jpg.. this is what i need it to look like, basically for example "Poll" has a default title, which i have removed from poll.module but not sure how to substitute it for an image

fumbling’s picture

You can create custom blocks with absolutely any html, javascript, etc, that you want to put into them by going to Site building >> Blocks >> Add block. Title is an optional field. Having said all that, Davidmorrow's advice below sounds on the mark for what you're trying to do.

Drupalot.com - ask & answer Drupal questions

grobemo’s picture

Keep the block title (using something descriptive for search engines and screen readers to find), and then replace it with a background image in CSS (i.e., set the title's visibility to hidden and add a background image). One way to pull this off on the server side would be to have the block title end with the filename for the image. During theming, remove that filename from the title and add an inline style to the block. Or do it on the client-side with JavaScript.

raymondfranco’s picture

Aish.. still confused.. sorry, my knowledge of this is very minimal.. will just keep trying, thanks though

grobemo’s picture

Don't worry about the dynamic theming stuff right now, then. We can work on that later.

First things first: Read this tutorial on CSS image replacement, and use that method to replace the title of your block with the image that you want.

Let us know if you have more questions.

raymondfranco’s picture

ok, fair enough, but where than other in the poll.module file will i find the tag to edit?

grobemo’s picture

Ah, right. Good question.

(1) Set the Poll block title to something that doesn't appear anywhere else in your source code—something like, say, "buffalo," which I'm guessing doesn't occur anywhere else on your page.
(2) Load a page that has the Poll block on it.
(3) Use Control-F (Command-F) to find 'buffalo'. Hopefully, 'buffalo' should be wrapped in some kind of header tag (<h3></h3>, for instance). Alter the visibility of that header tag. Set a background image in the <span> or <div> tag surrounding that header tag.

raymondfranco’s picture

Never mind.. Zeta showed me a VERY easy way to accomplish this:

http://drupal.org/node/274916

Thanks alot for your assistance.. it is REALLY appreciated..

Now to work on my other 3 blocks.. :/ that i need to custom create... sigh