PDA

View Full Version : background color


gruant2000381341
01-16-2010, 01:11 PM
how can i change the background color ? not like just around the text block...but for the entire background.

I guess I better add this.. I am not looking to change "just the general look for asthetics on the edit contents page"...what i want is to allow the user to have the color change applied to the actual page they are editing

shadow329043
01-16-2010, 01:24 PM
I think that all the styling is in the CSS files

gruant2000381341
01-16-2010, 01:42 PM
is there a way to change that dynamically ? I want it as more of an option as opposed to a preset.

I have found some javascript which works on changing div tag background color, but I don't know how to "add it into" my powercms so that the edited page will pick up that background color variable.

shadow329043
01-16-2010, 02:57 PM
Don't know how extensive a mod that would have to be - maybe one of the tech engineers will answer that one.

neilo
01-16-2010, 05:25 PM
You could do it by placing a body background colour style inside the head of the page and entering the CMS generated code inside it (removing the space before and after the code). Assuming the page is 'index.php', and you have called the edit region 'Page Colour', it would look like this:

<style type="text/css">
<!--
body {
background-color:<?php
include('/path/to/your/site/yoursite.comk/CMS/WA_CMS/addtosite.php');
echo WA_getCMSContent($database_localhost, $localhost, 'index.php' , 'Page Colour');
?>;
}
-->
</style>



As PowerCMS by default seems to insert <p> </p> round anything you type in, you would have enter the code in 'Source' view (HTML Editor 'Source' button) and type the colour in there - otherwise the <p> tags will stop it working.

You would enter either 'white' 'black' 'gray' 'red' 'blue' etc, or a hexidecimal number (including hash) i.e. #FFFFFF #000000 #999999 etc. You would have to trust that your clients aren't going to type in, "Reddish-brown, with a hint of peach".

I'm not sure I am man enough to let a client loose with page background colours on my designs though!

Perhaps I'm over-complicating it though. There must be away to add it to the HTML editor stylesheet (except you can't select the 'body' tag).

gruant2000381341
01-19-2010, 12:58 PM
Wow, I thought I paid just as much for this product as everybody else. And yet, nobody from WA can even bother if there is a way to achieve the result I need. Thats great

Jason Byrnes
01-19-2010, 03:18 PM
gruant,

So you want to be able to modify the body's background color? you are going to have to rely on your client ot be a little css savvy for this. but you could create a new contentArea for each page named "BodyStyle". In that content area, go to code view and enter an inline background style to be used by the body tag such as:

style="background-color: red;"




then edit the body tag to add the developer notes:
<body <?php echo WA_getCMSContent($database_localhost, $localhost,"testpage", "bodystyle"); ?>>

I guess you could even just have them type the color name for the content area:
"red"


and edit the body tag to place the CSS in front of it:
<body style="background-color:<?php echo WA_getCMSContent($database_localhost, $localhost,"testpage", "bodystyle"); ?>">

either way, this is relying on the client to enter a valid color css color name.

neilo
01-19-2010, 07:33 PM
You would also have to advise your client to choose colours different enough from those of the a:link, a:visited, and a:hover states or else add a way for him/her to change those too, otherwise links may seem to disappear. Even if you don't specify those, usually by default they are blue for links and maroon/mauve for visited.

What might be a more manageable solution could be - once your site is developed - to duplicate your main stylesheet (say) three times so you have styles1.css, styles2.css and styles3.css.

Then in each of the two (or more) new stylesheets change the style for background colour, link states, text colour, and any individual element properties, giving three (or more) defined page styles (themes) to choose from.

The CMS code would go in the head, like:

<link href="<?php
include('/home/users/uks66586/html/pictuality.co.uk/CMS/WA_CMS/addtosite.php');
echo WA_getCMSContent($database_localhost, $localhost, 'switch styles' , 'head css');
?>.css" rel="stylesheet" type="text/css" />


And the user would just need to enter 'style1', 'style2' or 'style3' into the alloted CMS area edit. They would just need to be literate for that.

So this page (http://www.pictuality.co.uk/temp/) is just one page but with a choice of three stylesheets that can be put in the head by the CMS. At least it would be, if you had access to my CMS. Because you can't, the demo is three copies of the same page, identical, but for the stylesheet name in the head.

Jason Byrnes
01-20-2010, 10:21 AM
Yes, that is an excellent way to do it as well.

Nicely done expanding on the concept I suggested, Neilo.

neilo
01-20-2010, 10:22 AM
Cheers Jason.

gruant2000381341
02-04-2010, 05:44 AM
I finally got this done, thanks for the suggestions.
I ended up building a module from scratch, and put the function right in the toolbar.
Now if the user wants to change the background color of the page, they just use use my color picking module. Using java, it resets on the fly..then saves that color code to a txt file. I set a get_contents on each page and then read in that code and parse in out as $bgcolor... then set the background color = $bgcolor.
Works great !
Wish I could implement a box so the user could add their hex code manually if so desired, but I am afraid of what might be entered by users who aren't in the know about those codes.