1
brmecham
How do I change the background color of one specific block?
  • 2005/7/21 4:29

  • brmecham

  • Just popping in

  • Posts: 35

  • Since: 2004/7/13


I have many custom blocks that I have created. I know how to edit style.css to make an entire column background color different, or to make all the block titles a different color.

BUT, how can I give one specific block a certain background color, or give certain block titles different colors?

let say I have 5 blocks in the left column and I want each one to have a different background color and different block-title color?

How do I do this?

2
EMSguy
Re: How do I change the background color of one specific block?
  • 2005/7/21 5:15

  • EMSguy

  • Just popping in

  • Posts: 86

  • Since: 2004/9/28


I beleive that the only way you can change one block is to change all in the style.css file for left center blocks or right center nlocks, etc.. not sure how to change just a single block. unless if you create a style statement for a specific block and call it from theme.html.

I am no expert so I may be wrong
"why don't you put her in charge!" aliens
Yes, I have a cool and crunchy exterior and a creamy geeky filling.

3
LazyBadger
Re: How do I change the background color of one specific block?

Quote:

brmecham wrote:
let say I have 5 blocks in the left column and I want each one to have a different background color and different block-title color?

How do I do this?

You have to solve: do you want different random decoration, or ordered some way, or only for one (or some) selected blocks? And also - does your theme must work on any site in "unmaintained" mode (no edits by hand, just use) or some preparation-steps are possible.

XOOPS haven't any pure methods to handle single-block AFAIK (FIXME if I'm wrong), thus - you can in theme ientify block by block-title only (which can be different on different sites) and change specific block presentation using results of this check... But Smarty IF must be edited according to local sutuation on other (not your) sites
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

4
xueming
Re: How do I change the background color of one specific block?
  • 2005/7/21 6:16

  • xueming

  • Not too shy to talk

  • Posts: 127

  • Since: 2005/2/7 6


Don't have time to try it, so just use my imagination here :)

Edit theme_blockleft.html: and add something like:

<{if $block_title == 'blah blah'}>
////set your block title color here
<{/if}>

////repeat until you set all the color for your title and content

Then set the background inside <div>

<div class="blockTitle"><{$block.title}></div>
<div class="blockContent"><{$block.content}></div>

If you do try it, let us know the results ...

5
monique
Re: How do I change the background color of one specific block?
  • 2005/7/22 11:05

  • monique

  • Just popping in

  • Posts: 62

  • Since: 2005/5/23


Here is what I've done in my theme and it seems to work:

<div class="hdr<{$block.id}>"><{$block.title}></div>
<div class="con<{$block.id}>"><{$block.content}></div>

I would love to hear from anyone and everyone if there is any reason I shouldn't refer directly to $block.id.

In my system, user menu block is ID=4, so the html that's generated by this is as follows:

<div class="hdr4">User Menu</div>
<div class="con4"><table cellspacing="0" class="usermenu" >

I set up style sheets with:

td#leftcolumn div.hdr4 { background-color: #99ff33;}
td#leftcolumn div.con4 { background-color: #99ff33;}

Soooo --- please, please, please -- if you know if a reason that $block.id would change, please let me know!

Thanks --

Monique.

6
LazyBadger
Re: How do I change the background color of one specific block?

Never heard and read about this smary-var.
2penny - this IDs are corect only for one your site, IDs for module's block can be changed even on your site - imagine module reinstall for examle
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

7
monique
Re: How do I change the background color of one specific block?
  • 2005/7/22 12:00

  • monique

  • Just popping in

  • Posts: 62

  • Since: 2005/5/23


Yes, but the concept is good, right? Does anyone know of a variable to access the block name or something that may not change upon reinstalling a module?

Monique.

8
brmecham
Re: How do I change the background color of one specific block?
  • 2005/8/4 22:29

  • brmecham

  • Just popping in

  • Posts: 35

  • Since: 2004/7/13


thanks for the advice, but I am still stuck.

I am a beginner when it comes to php/xoops programming. I have been able to change some things on my theme & style, but I still don't understand how to change the background color of a block.

If you wouldn't mind, Monique, or someone else who has done this, could you give me a simpler, or step-by-step explanation of how to do this?

9
LazyBadger
Re: How do I change the background color of one specific block?

Quote:

monique wrote:
Yes, but the concept is good, right?
Monique.

"Not so bad"... {$block.id} variable doesn't exist by default (AFAIK, all standard $xoops_<var> enumerated somewhere in docs, can't recall - where). I see only one permanent (dirty and not final) solution - edit all block's function in all used modules and generate one additional variable, which can be evaluated in theme's logic
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

10
Staren
Re: How do I change the background color of one specific block?
  • 2005/8/5 22:07

  • Staren

  • Just popping in

  • Posts: 17

  • Since: 2005/2/21


I haven't tried this, but don't see why it wouldn't work. Is there a reason you would not be able to simply add STYLE code to a blocks template? Something like?

STYLE="background-color: red; font-family: serif"

Just stick some dev tags at the start and end of the block, or wrap it in a table?

Login

Who's Online

245 user(s) are online (150 user(s) are browsing Support Forums)


Members: 0


Guests: 245


more...

Donat-O-Meter

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

Latest GitHub Commits