Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

There's rarely a good reason for mixing CGI.pm routines with actual HTML. You are also using poorly formed HTML. By making a few assumptions, I was able to get this. It's easier to read and maintain without the HTML. It's also easier to write it this way.

#!/usr/bin/perl use strict; use diagnostics; use CGI; # create a new CGI object my $page = new CGI; # used during testing # $page->param('Comic', 'Images/Le_Comic6.jpg'); # Grab a named CGI parameter my $comic = $page->param('Comic'); exit unless $comic; my $menu = $page->div({-class => 'Standard' }, $page->p( $page->cente +r( $page->a({-href => '../index.htm' }, '[Home]' ), $ +page->hr, $page->a({-href => '../Gallery.shtml' }, '[Gallery]' ), $ +page->hr, $page->a({-href => '../Manga.shtml' }, '[Manga]' ), $ +page->hr, $page->a({-href => '../Video_Review.shtml'}, '[Video Reviews]'), $ +page->hr, $page->a({-href => '../Links.shtml' }, '[Links]' ), $ +page->hr, $page->a({-href => '../Web_Comic.shtml' }, '[Web Comic]' ), $ +page->hr ))); my ($comment, $number, $comic_links); { my @file_names = qw| Images/Le_Comic.jpg Images/Le_Comic2.jpg Images/Le_Comi +c3.jpg Images/Le_Comic4.jpg Images/Le_Comic5.jpg Images/Le_Comi +c6.jpg Images/Le_Comic7.jpg Images/Le_Comic8.jpg Images/Le_Comi +c9.jpg Images/Le_Comic10.jpg Images/Le_Comic11.jpg Images/Le_Comi +c12.jpg Images/Thanksgiving_Comic.jpg |; # Open up the comments file open my $fh, '../Comment.txt' or die $!; my ($i, @links); foreach my $file_name ( @file_names ) { chomp( my $line = <$fh> ); ($comment, $number) = ($line, $i) if $file_name eq $comic; push @links, $page->a({-href=>"Testy.cgi?Comic=$file_name" +}, 'Comic #', ++$ +i); } $links[11] = $page->a({-href=>"Testy.cgi?Comic=$file_names[12] +"}, 'Thanksgiving Comi +c' ); $comic_links = $page->p( $page->b( $page->u('Comics') ) ) . $page->p( (join ' | ', @links[0 .. 4]), $page->br, (join ' | ', @links[5 .. 9]), $page->br, $links[10] ) . $page->p( $page->center( $page->u( $page->font( { -face => 'Comic Sans MS', -size => 4}) +)), $page->br, $links[11] ); } print $page->header, $page->start_html( -head => $page->Link({ -rel => 'stylesheet', -href => '../Style.css', -type => 'text/css'} ), -title => "Animetion Station > Webcomic > Comic #$number", -meta => { GENERATOR => 'Adobe PageMill 3.0 Win' } ); print # Web Comics $page->p( $page->center( $page->div( { -style => q| background-color: #0099FF; font-family: Comic Sans MS; font-size: 20px; width: 200px; color: white;| }, 'Web Comics' ))); print # Table $page->table( { -width => 757, -border => 0, -cellspacing => 1, -cellpadding => 0, -height => 294 }, $page->Tr( $page->td( { -width => '14%', -valign => 'TOP', -align => 'CENTER', -height => 293 }, $menu ), $page->td( { -width => '86%', -valign => 'TOP', -bgcolor => '#3366ff' }, $page->p( $page->center( $page->img( {-src => '../$value'} ) ) ), $page->br, $page->p($comment), $page->center( $page->div({ -style => q| font-family: Times New Roman, Time +s; color: white; width: 350px; background-color: gray; text-align: center;| }, $comic_lin +ks ) ) ) ) ), $page->end_html; __END__



HTH,
Charles K. Clarkson

And he puzzled three hours, till his puzzler was sore.
Then the Grinch thought of something he hadn't before!
- Dr. Seuss

In reply to Re: Stupid Program! by CharlesClarkson
in thread Program can't work on website; please examine code by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (8)
    As of 2014-12-27 20:21 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (177 votes), past polls