Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2024-04-19 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found