Log in

View Full Version : I need help, 2 questions. :)



NineTwoZero
01-06-2007, 12:34 PM
Hey, im new to php n relativly new to scripting but i was wondering if there's a working code (ima show what i want to do) for this..


Number 1.

<?php $style1
$style2
$browser = getenv("HTTP_USER_AGENT");

if $browser = mozilla;
<link href="style.css" rel="stylesheet" type="text/css" />;
else
<link href="style2.css" rel="stylesheet" type="text/css" />;
?>
Well as you might notice, im trying to use a different stylesheet depending on if its FF or IE (IE = else)

Number 2
id like to make the middle of my page into a "frameish thing"(<div id="index"> but not a frame. jus need the menu and banner/logo to NOT reload for the visitors.. would be cool. you can see how the site looks atm http://underground.ninetwozero.com <--- my "beta" site.

peace - Kalle

edit: the site looks f*cked up in IE?! :S

Titan85
01-06-2007, 04:27 PM
The site looked ok in IE, but it does have a blue border around the nav links. You can fix that simply by adding border="0" into your image link.
Change this:
<img src="img/banner3.png" alt="banner" />To this:
<img src="img/banner3.png" alt="banner" border="0" />That should take out the blue borders. As for your question about switching css sheets depending on browser, I am unsure how that can be done, but I believe it can. Hopefully someone will know and post it :)

NineTwoZero
01-06-2007, 06:41 PM
thank you very much :) IE seems to have problems with a:img in css :(

any1 got solution for nr1 or nr2? :D

thetestingsite
01-06-2007, 06:49 PM
Well for number 1, it would be easier to use Javascript for this. The code you posted abouve would parse errors with every line. I currently don't have the time to explain what's wrong with it, but maybe someone else could. I recommend taking a look at the following two scripts here on dynamic drive maybe even merging them together.

http://www.dynamicdrive.com/dynamicindex9/dyncss.htm
http://www.dynamicdrive.com/dynamicindex9/bredirect.htm

Hope this helps for now.

NineTwoZero
01-06-2007, 06:53 PM
aiiit ill check them out :) the first error in my script was on line 3 xP but I jus wrote it to give you guys an idea of what i wanna acomplish.

thetestingsite
01-06-2007, 06:57 PM
Well, when using server side scripting to get the browser agent, it prints out the entire information about it. Try the following code to see what I mean (be sure to view them in different browsers as well).



<?php
<?php

$browser = getenv("HTTP_USER_AGENT");

echo $browser;
?>


It would be hard to determine which stylesheet to use by doing this, that is why I recommend using Javascript.

NineTwoZero
01-06-2007, 06:59 PM
i'll try to combine the two scripts you linked me to.

thank you :)

Titan85
01-07-2007, 05:31 AM
Glad my little knowledge could help out :). I was looking at your CSS and noticed that you didn't have float: left; on many of your divs. When I code with CSS, I have a float: left on every div tag unless i set it to float: right. I am not sure if this is the problem with the way IE is displaying it, but its worth a shot ;)

djr33
01-07-2007, 07:25 AM
There is an extra <?php in thetestingsite's php code. Remove that.

Also, there is another thread about this.... not sure why it's here twice. Please only post one thread. We'll be happy to answer it and help, but no need to do so twice.

http://www.dynamicdrive.com/forums/showthread.php?t=16290

thetestingsite
01-07-2007, 03:31 PM
Oh wow, I completely missed that. Thanks, djr33. I guess that's what happens when you are working, talking to customers troubleshooting their problems, then typing up code on here. Anyway, thanks.

NineTwoZero
01-07-2007, 03:39 PM
titan: ye i know :D but the site looks wierd in IE, the index appears lower than it should there. thats why i need double stylesheets with autoswitch ;p

NineTwoZero
01-07-2007, 03:45 PM
every1 in this thread, please move on to the other one :p

http://www.dynamicdrive.com/forums/showthread.php?t=16290