Our site www.viart.com site is operated by latest Viart Shop 5 with default Clear design
Topic Information
Dutyman (Guest)
Dutyman (Guest)
Is it possible to change the background in individual blocks? I Want to make the special offer block a different color than the rest.
 
tony
tony
Hi Dutyman
 
The answer is YES!
 
To set different background colour to your custom blocks, please open your css style file and insert the below strings at the end of the file:
 
.bl_custom .titleTopLeft {background: #00f;}
.bl_custom .titleTopCenter {background: #00f;}
.bl_custom .titleTopRight {background: #00f;}
.bl_custom .block {background: #00f;}
.bl_custom .usual {background: #00f;}
 
If you are using a custom block without title, then just change .bl_custom to .bl_simple.
 
 
Tony
HolleyLand.com
 
Ned
Ned
block_custom.php (4Kb)  block_custom.html (1Kb)  block_simple.html (916 bytes)  
Tony, I think the original query was to have a colour in different blocks rather than all of them.
 
Dutyman, there is a way to do this.
First backup "blocks/block_custom.php" and replace it with the attached one. This creates a new custom_id call {custom_id} for passing to the templates.
 
Now copy the attached "block_simple.html" and "block_custom.html" into your layout templates folder. This adds a new id of "bl_{custom_id}" - the "bl_" is to make the id unique on the page.
 
Lastly add to the css styles file and for each block you want to colour, at the end add..........
.bl_custom#bl_N{background: #DD0000;} /* for blocks with titles */
.bl_simple#bl_N{background: red;} /* for blocks without titles */
........where "N" is the number of the block ID you wish to colour from "Administration > CMS > Custom Blocks".
You can obviously move the new id around on the templates pages to suit your requirements, for example move it down into the table "block" class.
 
TOCDCO
TOCDCO
Hey, thanks Ned. I've actually been doing this manually via Expression web and moving over the html. This helps tremendously!!
 
Awesome.
 
Ned
Ned
block_custom_page_body.php (685 bytes)  
This idea can also be applied to the backgrounds of the index and individual custom pages.
 
For Custom Pages backup and replace "blocks/block_custom_page_body.php" with the attached file. This takes the $page_id variable and creates a new variable called {page_custom_id} for passing to the templates.
 
You then need to change "templates/(yourlayout)/page.html" at line 16 to
<body class="commonbg" id="pg_{page_custom_id}">. The "pg_" prefix is to make the id unique on the page.
 
The styles/(yourlayout).css file already has
.commonbg ( etc..
which provides the background to the index page and all others.
So to over-ride the backgrounds in other custom pages add:
commonbg#pg_N{background: #DD0000;}
.......where "N" is the number of the page ID you wish to colour from "Administration > CMS > Custom Pages".
Last modified: 16 Aug 2008 8:38 AM
 
TOCDCO
TOCDCO
Thanks Ned.
 
This is why we need to create our own group manual of all of the things we've come up with and help defining the manual.
 
Dan
 
gotmeawebsite
gotmeawebsite
Wow this sure helps..
 
I am planning on designing some custom templates for my store and this goes a long way to help with the efforts I am trying to get done.Smile
 
SajMalik
SajMalik
Dan - just what went through my mind - a couple of weeks and this is all lost and when it gets raised again we all go searching through the threads trying to find it.
Or Ned has to keep a portfolio of his great responses to keep dishing out Wacko
 
beerfan (Guest)
beerfan (Guest)
One question when trying to add the block and page body scripts. Are you supposed to delete the previous code in the css or add it? I have added it and am not able to see any changes due to the settings associated with "commonbg" and the block background.
 
TOCDCO
TOCDCO
What version are you using?
 
What type of block is it? All of them, or an individual one?
 
Ned
Ned
You should add the code to the .css file. Your web browser will start at the top of the file and add or amend styles as it progresses down the file.
 
So if you declare a style you can redeclare it later.
 
Do however remember when changing .css files that you must reload or refresh the page you are viewing so that the new version of the .css file is used.
 
As before if you are a Windows user there is Stylizer at http://www.skybound.ca/ which others have found of great help.
 
beerfan (Guest)
beerfan (Guest)
I am using v3.4.5.
 
below is how the code appears in the css.
 
.block {
border-top: 0px solid #781213;
border-right: 0px solid #781213;
border-bottom: 0px solid #781213;
border-left: 0px solid #781213;
background: #ffffff;
}
 
/******Block Background - Individual, where N equals custom block number from ADMIN*****
.bl_custom#bl_51{background: #781213;} /* for blocks with titles */
.bl_simple#bl_51{background: #781213;} /* for blocks without titles */
 
 
 
.commonbg#pg_8 {background: #ffffff; }
.commonbg#pg_index {background: #781213; }
.commonbg { background: #781213; }
.headerbg { background: #781213; }
.middlebg { background: #781213; }
.usualbg { background: #781213; }
.errorbg { background: #cc0000; }
 
 
I will visit skbound.