Warptweet Posted January 21, 2007 Share Posted January 21, 2007 How would I make it so that I can change the background color/image of my website to something else using php? I'm positive it's not include("XXXXXXX")Can anyone help me on how to make my website completely customizable?Is this a matter of CSS or something? Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 21, 2007 Share Posted January 21, 2007 XHTML/CSS, the styling and coloring would have nothing to do with PHP unless you were simply outputting different CSS styles with php. The entire thing that would control the style's is CSS.in an external stylesheet, to the style you want to add a background color addbackground-color:#CCCCCC;or whatever other hex code for whatever other color you wanted, the background would change to that color. Quote Link to comment Share on other sites More sharing options...
Warptweet Posted January 21, 2007 Author Share Posted January 21, 2007 How would I include a .css file onto my webpage?Would it be a PHP code? Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 21, 2007 Share Posted January 21, 2007 No it would be <link rel="stylesheet" type='text/css" href="/path/to/css.css" />/path/to/css.css = The relative url path to your css file.It has nothing to do with CSS code UNLESS you are outputting the css with php dynamically for some reason (A user based cms, or something similar. Quote Link to comment Share on other sites More sharing options...
Warptweet Posted January 21, 2007 Author Share Posted January 21, 2007 Okay, then I have another question..........If I have a form, for instance, has this...Background Color: (Type HEX code)And then I click SUBMIT, what PHP code would I use in order to change the CSS background color to the HEX color I submitted in the form? Quote Link to comment Share on other sites More sharing options...
scotmcc Posted January 21, 2007 Share Posted January 21, 2007 The easiest way to do this using PHP, if I understand your question correctly, is to set a field in your database, for example, bgcolor. then when the page loads do something like:[code]<style bgcolor="$bgcolor">[/code]If you have the variable 'modify-able' by the user, when the refresh the page the bgcolor will be set to whatever they selected. You might want to do some looking into PHP / Stylesheets. There are some good examples of 'php-enabled' stylesheets on the web.[url=http://www.barelyfitz.com/projects/csscolor/]http://www.barelyfitz.com/projects/csscolor/[/url] is a good place to start :)Scot Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 21, 2007 Share Posted January 21, 2007 Well, maybe notIf you wanted to do it instantly, (low level), use javascript and cookies (sessions)Or if you wanted them to really have long distance editing capabiliteis (They had there own pages, you wanted them having permanent control over), save the settings in a database, then let php fetch those settings based on there ip when they return Quote Link to comment Share on other sites More sharing options...
Warptweet Posted January 21, 2007 Author Share Posted January 21, 2007 So there isn't anything like some CSS variables that I could use to change style.css or anything? Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 21, 2007 Share Posted January 21, 2007 You can change it in Javascript.You can use PHP to generate the CSS and pass it variables for the colors. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.