Home : Products : Gossamer Forum : Discussion :

Products: Gossamer Forum: Discussion: Re: [unixman] Using a CSS script: Edit Log

Here is the list of edits for this post
Re: [unixman] Using a CSS script
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

Edit Log: