Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Re: [unixman] Using a CSS script

Quote Reply
Re: [unixman] Using a CSS script In reply to
Make the following adjustments (annotated below).

Code:
sub { my $site = "http://argus.bus.ucf.edu";
my $path = "css";
my $browser = "$ENV{'HTTP_USER_AGENT'}";
$browser =~ tr/A-Z/a-z/;
my $css_file;
if ($browser =~ /win/ && $browser =~ /msie/) { my $css_file = "ie.css"; }
elsif ($browser =~ /win/ && $browser =~ /mozilla/) { $css_file = "nav.css"; }
elsif ($browser =~ /mac/) { $css_file = "mac.css"; }
else { $css_file = "unix.css"; }
my $css_serve_code_line .= "<!-- Browser detected: $browser -->\n";
$css_serve_code_line .= "<link rel=\"stylesheet\" href=\"$site/$path/$css_file\" type=\"text/css\">\n";
$css_serve_code_line .= "<style type=\"text/css\">\n";
$css_serve_code_line .= "<!--\n";
$css_serve_code_line .= "a:link { color: #3366CC; text-decoration: none; }\n";
$css_serve_code_line .= "a:visited { color: #3366CC; text-decoration: none; }\n";
$css_serve_code_line .= "a:hover { color: #AC9431; text-decoration: underline; }\n";
$css_serve_code_line .= "-->\n";
$css_serve_code_line .= "</style>\n";
return $css_serve_code_line; }

Add the extra line which is outlined in bold above and remove the my that is outlined in red from your code. If you put my inside your if loop then the variable won't be available outside of it. You need to define the variable first before entering the loop.

You should end up with this:

Code:
sub { my $site = "http://argus.bus.ucf.edu";
my $path = "css";
my $browser = "$ENV{'HTTP_USER_AGENT'}";
$browser =~ tr/A-Z/a-z/;
my $css_file;
if ($browser =~ /win/ && $browser =~ /msie/) { $css_file = "ie.css"; }
elsif ($browser =~ /win/ && $browser =~ /mozilla/) { $css_file = "nav.css"; }
elsif ($browser =~ /mac/) { $css_file = "mac.css"; }
else { $css_file = "unix.css"; }
my $css_serve_code_line .= "<!-- Browser detected: $browser -->\n";
$css_serve_code_line .= "<link rel=\"stylesheet\" href=\"$site/$path/$css_file\" type=\"text/css\">\n";
$css_serve_code_line .= "<style type=\"text/css\">\n";
$css_serve_code_line .= "<!--\n";
$css_serve_code_line .= "a:link { color: #3366CC; text-decoration: none; }\n";
$css_serve_code_line .= "a:visited { color: #3366CC; text-decoration: none; }\n";
$css_serve_code_line .= "a:hover { color: #AC9431; text-decoration: underline; }\n";
$css_serve_code_line .= "-->\n";
$css_serve_code_line .= "</style>\n";
return $css_serve_code_line; }

I hope this helps.

- wil

Last edited by:

Wil: Apr 22, 2002, 6:06 AM
Subject Author Views Date
Thread; hot thread Using a CSS script unixman 10578 Apr 21, 2002, 6:19 PM
Thread; hot thread Re: [unixman] Using a CSS script
Alex 10411 Apr 21, 2002, 7:08 PM
Thread; hot thread Re: [Alex] Using a CSS script
unixman 10367 Apr 21, 2002, 7:24 PM
Thread; hot thread Re: [unixman] Using a CSS script
Alex 10380 Apr 21, 2002, 7:25 PM
Thread; hot thread Re: [Alex] Using a CSS script
unixman 10366 Apr 21, 2002, 7:43 PM
Thread; hot thread Re: [unixman] Using a CSS script
Paul 10406 Apr 22, 2002, 1:43 AM
Thread; hot thread Re: [Paul] Using a CSS script
unixman 10345 Apr 22, 2002, 5:42 AM
Thread; hot thread Re: [unixman] Using a CSS script
Wil 10406 Apr 22, 2002, 6:05 AM
Thread; hot thread Re: [Wil] Using a CSS script
unixman 10380 Apr 22, 2002, 6:50 AM
Thread; hot thread Re: [unixman] Using a CSS script
Wil 10486 Apr 22, 2002, 6:53 AM
Thread; hot thread Re: [Wil] Using a CSS script
unixman 10417 Apr 22, 2002, 6:54 AM
Thread; hot thread Re: [unixman] Using a CSS script
Wil 10445 Apr 22, 2002, 6:58 AM
Thread; hot thread Re: [Wil] Using a CSS script
unixman 10438 Apr 22, 2002, 7:03 AM
Post; hot thread Re: [unixman] Using a CSS script
Wil 10381 Apr 22, 2002, 7:04 AM
Post; hot thread Re: [unixman] Using a CSS script
unixman 10416 Apr 22, 2002, 7:20 AM
Thread; hot thread Re: [Wil] Using a CSS script
Paul 10443 Apr 22, 2002, 7:05 AM
Thread; hot thread Re: [Paul] Using a CSS script
unixman 10583 Apr 22, 2002, 7:09 AM
Thread; hot thread Re: [unixman] Using a CSS script
Wil 10450 Apr 22, 2002, 7:14 AM
Post; hot thread Re: [Wil] Using a CSS script
unixman 10379 Apr 22, 2002, 7:17 AM
Thread; hot thread Re: [Wil] Using a CSS script
Paul 10362 Apr 22, 2002, 7:24 AM
Thread; hot thread Re: [Paul] Using a CSS script
unixman 10377 Apr 22, 2002, 7:27 AM
Post; hot thread Re: [unixman] Using a CSS script
Paul 10324 Apr 22, 2002, 7:31 AM
Thread; hot thread Re: [Paul] Using a CSS script
Wil 10404 Apr 22, 2002, 7:35 AM
Thread; hot thread Re: [Wil] Using a CSS script
Paul 2048 Apr 22, 2002, 7:41 AM
Thread; hot thread Re: [Paul] Using a CSS script
Jagerman 1917 Apr 22, 2002, 12:22 PM
Post; hot thread Re: [Jagerman] Using a CSS script
Wil 1891 Apr 22, 2002, 12:23 PM
Thread; hot thread Re: [Paul] Using a CSS script
Wil 10375 Apr 22, 2002, 7:10 AM
Post; hot thread Re: [Wil] Using a CSS script
unixman 10351 Apr 22, 2002, 7:13 AM