Browser-Dependent Stylesheets using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
norm188
Forum Newbie
Posts: 8
Joined: Sun Mar 23, 2003 10:14 pm

Browser-Dependent Stylesheets using PHP

Post by norm188 »

Hi,

I'm using this script:

<script language="php">

$browser = get_browser();

if ( $browser->browser == "IE" )
{
print ("<link rel=stylesheet href=internet-explorer-stylesheet.css>");
}

if ( $browser->browser == "Netscape" )
{
print ("<link rel=stylesheet href=netscape-stylesheet.css>")
}

</script>

But i get this error:

Warning: get_browser() [function.get-browser]: browscap ini directive not set. in /home/geilese/public_html/project/index.php on line 7

How can i fix this
Thanks, Norm
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://www.php.net/manual/en/function.get-browser.php
In order for this to work, your browscap configuration setting in php.ini must point to the correct location of the browscap.ini file on your system. browscap.ini is not bundled with PHP but you may find an up-to-date browscap.ini file here. By default, the browscap directive is commented out.
norm188
Forum Newbie
Posts: 8
Joined: Sun Mar 23, 2003 10:14 pm

Post by norm188 »

Thanks for the advice I realy appriciate it.

I know what to do now.

Thanks,
Norm
Post Reply