style

liunx

Guest
i think this is a CSS question

i want people to be able to load different styles for my site.

if i make 5 .css files and have 5 buttons on my site can it change the style sheet according to the button they press.

can you control images in .css files? if so HOW?


thanks alotYou would have to have 5 different pages for the 5 different styles.
To use CSS to control ALL images you can do something like this:

<style type="text/css"><!--

img{width:100px;height:100px;}

--></style>To change the styles, you will need to use either javascript or a serverside language. The latter is MUCH better, as it will work for those without javascript enabled (13%). On <!-- m --><a class="postlink" href="http://www.webdevfaqs.com">http://www.webdevfaqs.com</a><!-- m --> we did this useing PHP to set a cookie with their preferences set.ok thanksYou bet... ;)Originally posted by pyro
To change the styles, you will need to use either javascript or a serverside language. The latter is MUCH better, as it will work for those without javascript enabled (13%). On <!-- m --><a class="postlink" href="http://www.webdevfaqs.com">http://www.webdevfaqs.com</a><!-- m --> we did this useing PHP to set a cookie with their preferences set.
I believe thats OK as long as javascript is just for changing the look of the site... something superficial. It should not be used for some key element of site (such as navigation)Yes, but my philosophy on it would be why use javascript for things that can be done serverside? I can see no benefit to using javascript over PHP (or any other apporopriate serverside language). But, I agree, if the site still continues to function, it's not a big deal if users with javascript disabled are not able to change the stylesheets used to present the page.so can someone help or point me in the right direction on how to do this.:)With PHP, it would go like this:

Set up your links to change the styles something like this:

<a href=http://www.webdeveloper.com/forum/archive/index.php/"changecss.php?file=default>default style</a>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"changecss.php?file=stylesheetname>change style</a>

Where changecss.php looks like this:

<?PHP
$loc = $_SERVER["HTTP_REFERER"];
$css = $_GET["file"];

setcookie("stylesheets",$css,time()+31536000); #one year
header ("Location:$loc");
?>Then, on each page, include this bit of PHP where the stylesheets should be displayed (<head>):

<?PHP
if(isset($_COOKIE["stylesheets"])) {
$val = $_COOKIE["stylesheets"];
if ($val == "stylesheetname") {
echo "<link rel=\"stylesheet\" href=http://www.webdeveloper.com/forum/archive/index.php/\"stylesheetname.css\" type=\"text/css\">";
}
else {
echo "<link rel=\"stylesheet\" href=http://www.webdeveloper.com/forum/archive/index.php/\"default.css\" type=\"text/css\">";
}
}
else {
echo "<link rel=\"stylesheet\" href=http://www.webdeveloper.com/forum/archive/index.php/\"default.css\" type=\"text/css\">";

}
?>ok thanks.

i will try it out later when i wake up and get back 2 you

but it looks goodfor some f***ing reason my server will not let me upload

can anyone tell me how i can test PHP on my local server (my computer)

as simple as possible, i don't no **** about PHPwell to set PHP up on my computer i used this tutorial:

<!-- m --><a class="postlink" href="http://robouk.mchost.com/tuts/tutorial.php?tutorial=server1">http://robouk.mchost.com/tuts/tutorial. ... al=server1</a><!-- m -->

i found it very easy to follow, just skip the MySQL part if you arent interested in that;)lol:eek:

i am using the EXACT same tutorial

just none of the links to the setup files work, i can't download;

Apache 1.3.5
Mysql 3.23.49
or
PHP 4.2.0lol yeah some of the links are a bit outdated, you have to search around a bit...but after that its fine...

<!-- m --><a class="postlink" href="http://www.apache.org/dist/httpd/binaries/win32/old/apache_1.3.24-win32-x86-no_src.exe">http://www.apache.org/dist/httpd/binari ... no_src.exe</a><!-- m -->

<!-- m --><a class="postlink" href="http://www.mysql.com/downloads/download.php?file=Downloads/MySQL-3.23/mysql-3.23.49-win.zip&pick=mirror">http://www.mysql.com/downloads/download ... ick=mirror</a><!-- m --> - it seems to be there, try downloading it from a mirror down below...

<!-- m --><a class="postlink" href="http://ca3.php.net/get/php-4.3.2-installer.exe/from/a/mirror">http://ca3.php.net/get/php-4.3.2-instal ... m/a/mirror</a><!-- m --> - theres 4.3.2, its stable, and its what i downloaded...its workin fine;)thats great.

so now i can test PHP on my local servercan you help me set up the Mysql part i can't do it i just get error messages.

aslo the script you posted what parts do i change?

thanks alotIf you aren't familiar with Apache you could have downloaded phpdev: <!-- m --><a class="postlink" href="http://www.firepages.com.au/dev4.htm">http://www.firepages.com.au/dev4.htm</a><!-- m --> to make life easier.
 
Back
Top