PDA

View Full Version : perl help


jmoney3457
15 Oct 2007, 2:04am
anyone here good/know perl? im having some trouble adding background image & changing font & size here (http://ctech.smccme.edu/~frauttenj/cgi-bin/grade.pl)

lightnin
15 Oct 2007, 4:20pm
how bout some source code?

jmoney3457
15 Oct 2007, 5:32pm
how bout some source code?
eh?:confused:

lightnin
15 Oct 2007, 6:37pm
um... you needed perl help right? or do you need html help? i was asking for the perl source code... cant fix the problem if i cant see it. your link is to generated html, so i have no idea if you need html tweaks or if there's some nasty perl bug causing hiccups.

Lincoln
15 Oct 2007, 6:37pm
im having some trouble adding background image & changing font & size here (http://ctech.smccme.edu/%7Efrauttenj/cgi-bin/grade.pl)
Perl has nothing to do with changing font and size in HTML. Perl is a server-side scripting language that spits out the HTML (and possibly CSS) to the browser; it doesn't directly control styling itself.

You need to sit down with an HTML & CSS intro book (http://www.amazon.com/XHTML-Sixth-Visual-Quickstart-Guide/dp/0321430840/ref=pd_bbs_sr_1/102-8213692-8000104?ie=UTF8&s=books&qid=1192470065&sr=8-1) for an afternoon before you get into Perl.

Pro tip: Never, ever use the "font" tag. Ever. ;)

lightnin
15 Oct 2007, 6:42pm
unless he's changing font size, color, and backgrounds with perl before the html is sent client side. still could be a perl issue....

that being said.. keebs makes mention of a wonderful bit of technology called css. you could be outputting html from perl but using css to control the look and feel of your end result. might be easier than hard coding colors and font sizes in your script.

jmoney3457
15 Oct 2007, 10:31pm
sorry bout that lol now i know what you mean here it is..im trying to insert font style/size etc & BG image w/ css:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><head><title> Grades</title></head> <body>";
print "<body bgcolor=yellow>\n";
$grade = 67;
$grade2 = 75;
$grade3 = 67;
$grade4 = 75;
$grade5 = 70;
$grade6 = 65;
$average = ($grade + $grade2 + $grade3 + $grade4 + $grade5 + $grade6) / 6;

$cubedgrade = 3 ** 3;
$onemore = $cubedgrade + 1;
$remainder = #onemore % 3;

print "grade 1 is $grade\n<br>";
print "grade 2 is $grade2\n<br>";
print "grade 3 is $grade3\n<br>";
print "grade 4 is $grade4\n<br>";





print "grade 5 is $grade5\n<br>";
print "grade 6 is $grade6\n<br>";
print "the average of all the grades is $average\n<br>";



print "3 cubed is $cubedgrade<br>";
print "one more than the cubed grade is $onemore<br>";
print "The remainder is $remainder<br>";
############################

if($average >= 93){
print "<font color=blue>hey you got an A!";
print "</font><br>";
}
elsif($average >= 82) {
print "<font color=orange>hey you got a B";
print "</font><br>";
}
elsif($average >= 70) {
print "<font color=purple>hey you got a C";
print "</font><br>";
}
elsif($average >= 65) {
print "<font color=green>hey you got a D";
print "</font><br>";
}
elsif($average <= 64) {
print "<font color=brown>hey you got a F";
print "</font><br>";
}


print "This is the end";

Lincoln
16 Oct 2007, 2:01am
You didn't wrap the code in "PHP" or "code" tags, so the forum converted the HTML to VB code and it's unreadable now. I strongly suspect this is not a Perl problem, it's an HTML problem (you're printing incorrect HTML, not screwing up Perl code).

jmoney3457
16 Oct 2007, 2:18am
You didn't wrap the code in "PHP" or "code" tags, so the forum converted the HTML to VB code and it's unreadable now. I strongly suspect this is not a Perl problem, it's an HTML problem (you're printing incorrect HTML, not screwing up Perl code).

oops thx keeb ok code & PHP didn't seem to help either so ive uploaded it as notepad attachment any help on getting BG image & different font style/size using CSS would be helpful:)

Lincoln
16 Oct 2007, 3:02am
When you assign an attribute to an HTML tag like color, the value needs to be in quotes. So it's:

< font color="green" >

NOT:

< font color=green >

However, like I said, you should never, ever use the font tag. Use CSS. I can't teach you CSS in a forum post - I highly recommend the linked book above if you're going to continue making websites. Trying to tackle Perl before learning HTML/CSS is totally backwards.

lightnin
16 Oct 2007, 3:04pm
yeah keebs is right... it's not perl per se you're having a problem with. being more familiar with the fundamentals of html syntax and structuring will help you a ton in the long run... it's not too difficult. once you can do html/css pretty well then webapps will come together much easier for you.

good luck.

jmoney3457
16 Oct 2007, 4:47pm
these are just for college class nothing else lol but don't i need like the intro CSS tag?

Lincoln
16 Oct 2007, 4:55pm
If you want to embed CSS in the same document, you need to put it in the document head inside < style > tags. Seriously... you need a reference and/or tutorial book for this.