Page 1 of 1

Browser-Dependent Stylesheets using PHP

Posted: Fri May 02, 2003 11:25 am
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

Posted: Fri May 02, 2003 1:39 pm
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.

Posted: Fri May 02, 2003 10:44 pm
by norm188
Thanks for the advice I realy appriciate it.

I know what to do now.

Thanks,
Norm