I'm having a bit of trouble with some CGI...I know that it is opening the stuff correctly, and it
should be printing it, but it isn't for some reason, even if I go to main.cgi?link=news . All I get is "PieFart.". Does anyone have any idea as to what's going wrong? I know that the open and print for $pagerep works, as putting it into a separate program worked fine for me...Here's my code, see if you can figure it out:
use CGI qw(:standard);
print header();
my $loginoutlink='';
my $loginout='';
my $usersilver='';
my $ore='';
my $userhp='';
my $usermana='';
my $userlvl='';
my $userexp='';
my $userexpnext='';
my $pagetext='';
my $pagetitle='';
my $mainpagename='';
my $specificpagename='';
my $pagerep='';
my $pageaction='';
$pageaction=param('link');
my $textpage='';
if($pageaction eq 'news') {
open(NEWS,"news.html");
while(<>) {
$pagetext .= $_;
}
close NEWS;
open(PAGE,"template.htmlt");
while(<PAGE>) {
$pagerep .=$_;
}
close PAGE;
$pagerep=~s/PAGETITLE/KnightScape News/;
$pagerep=~s/MAINPAGENAME/KnightScape News-Your TableSpoon of Knigh
+tScape Info!/;
$pagerep=~s/SPECIFICPAGENAME/Recent News/;
$pagerep=~s/PAGETEXT/$pagetext/;
}elsif($pageaction eq 'records') {
}elsif($pageaction eq 'quests') {
}elsif($pageaction eq 'help') {
}elsif($pageaction eq 'ask') {
}elsif($pageaction eq 'login') {
}elsif($pageaction eq 'logout') {
} else {
}
print "$pagerep";
print "PieFart.";
Thanks,
Spidy
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.