Tags:
create new tag
, view all tags
After installing the 01 Sept 2001 version, I noticed that the format of the supplied TWikiWebsTable looked different. I saw that border= and BGcolor= etc changed the look of the hardcoded table. I wanted to make all my TWiki topic contained tables look like that too, so I found in TWiki.pm sub emitTR where this is done. Alas, it looked OK with my MSIE but Netscape didn't render it quite right. I found that I needed border=1 to look OK with Netscape and Border=0 for MSIE. The following code snippet is what I came up with:
sub emitTR {                                                            
    my ( $thePre, $theRow, $insideTABLE ) = @_;                         
                                                                        
    my $text = "";                                                      
    my $attr = "";                                                      
    my $l1 = 0;                                                         
    my $l2 = 0;                                                         
    my $bord = 0;                                                       
    if( $insideTABLE ) {                                                
# DNM add bgcolor                                                       
        $text = "$thePre<tr bgcolor=\"#ffffff\">";                      
    } else {                                                            
# DNM add bgcolor and change border and spacing                         
# DNM check for MSIE and set border accordingly. IE looks OK with       
#     border 0, Netscape needs atleast 1                                
        if ( ! ( $ENV{HTTP_USER_AGENT} =~ /MSIE/g) ) {                  
          $bord = 1;                                                    
        } else {                                                        
          $bord = 0;                                                    
        }                                                               
        $text = "$thePre<table border=\"$bord\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#000000\"> <tr bgcolor=\"#ffffff\">";      
    }                                                                   
    $theRow =~ s/\t/   /go;  # change tabs to space                     
    $theRow =~ s/\s*$//o;    # remove trailing spaces                   
Does this seem useful to anyone else?

-- DanaMitchell - 20 Nov 2001

Topic revision: r1 - 2001-11-20 - DanaMitchell
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.