Code Comments
Programming Forum and web based access to our favorite programming groups.my $sth = $dbh->prepare( "SELECT * FROM games" );
$sth->execute();
Hello, iam tryign to convert another script to htm;::template but iam
having some problems:
Here is the template:
<html>
<head>
<title>Games</title>
<link rel="stylesheet" type="text/css"
href="../data/tmpl/style.css" />
</head>
<body>
<h2>Από εδώ μπορείς να κατεβάσεις ωραία απλ
ά παιχνίδια που _χω
επιλ_ξει!</h2>
<h2>Μπορείς να επικοινωνήσεις μαζί μου στο
hackeras@gmail.com</h2>
<table>
<TMPL_LOOP NAME=games>
<TR>
<td><TMPL_VAR NAME=gamename></td>
<td><TMPL_VAR NAME=gamedesc></td>
<td><TMPL_VAR NAME=gamecount></td>
</TR>
</TMPL_LOOP>
</table>
<h2>Είσαι ο <TMPL_VAR NAME=gamecount>ος που κατεβάζει τ
ο <TMPL_VAR
NAME=gamename>!</h2>
<h2>Ελπίζω να σου αρ_σει και να σου φανεί χρ
ήσιμο!</h2>
<div id=links>
<a href="index.pl"><img src="../data/images/back.gif" /></a>
</div>
<script language='Javascript'>location.href='/data/games/<TMPL_VAR
NAME=gamename>.rar'</script>
</body>
</html>
And here is the games.pl part that i dotn know how to convert entirely,
please help me out:
my $tmpl = HTML::Template->new(filename=>'../data/tmpl/games.tmpl');
$tmpl->param( games=>$sth->fetchall_arrayref({}) );
print header, $tmpl->output;
if ( !param() ) { print p( a( {href=>'index.pl'}, img
{src=>'../data/images/back.gif'} )); }
if ( param() )
{
$dbh->do( "UPDATE games SET gamecount = gamecount + 1 WHERE
gamename='$game'" );
$sth = $dbh->prepare( "SELECT $game FROM games" );
$sth->execute();
$row = $sth->fetchrow_hashref;
$dbh->do( "UPDATE guestlog SET script='$game' WHERE host='$host'" )
or die $dbh->errstr;
print p( a( {href=>'index.pl'}, img
{src=>'../data/images/back.gif'} ));
print "<script
language='Javascript'>location.href='/data/games/$game.rar'</script>";
}
What am i doing wrong?
Post Follow-up to this messageNikos wrote: > my $sth = $dbh->prepare( "SELECT * FROM games" ); > $sth->execute(); > > Hello, iam tryign to convert another script to htm;::template but iam > having some problems: > Here is the template: > <snip usual tale of woe> So what you are saying is: despite all the help you were given with a pretty much identical problem over quite a long period of time, by a number of very patient posters (I've lost all patience, as you can tell) you have learnt nothing and want to be spoon-fed the entire development process *again*?
Post Follow-up to this messageMark Clements wrote: > Nikos wrote: > > <snip usual tale of woe> > So what you are saying is: despite all the help you were given with a > pretty much identical problem over quite a long period of time, by a > number of very patient posters (I've lost all patience, as you can tell) > you have learnt nothing and want to be spoon-fed the entire development > process *again*? You have right to feel that way you are feeling but unfortunately i am again stuck. At that time yes i would like a little spoonfeeding but the template its done(i guess its correct since now i have problem with MySQL too and i cant test it), the only help i need is with the snippet of games.pl I understand if you dont want to help, so please ignore my posts if you like, but i hope you dont. Maybe someone else dont mind helping me a bit more.
Post Follow-up to this messageNikos wrote: > > > You have right to feel that way you are feeling but unfortunately i am > again stuck. > > At that time yes i would like a little spoonfeeding but the template its > done(i guess its correct since now i have problem with MySQL too and i > cant test it), the only help i need is with the snippet of games.pl > > I understand if you dont want to help, so please ignore my posts if you > like, but i hope you dont. > > Maybe someone else dont mind helping me a bit more. You just *don't* get it, do you? Here is what happens with your postings, time after time: 1. you post a load of badly checked code and say (almost literally) "this doesn't work - what's wrong". 2. somebody posts pointing out problems with your code (of which there are normally many), and with the question itself, and gives you pointers as to how the question could be better-framed and better partitioned, and suggests that you really could do more work for yourself, suggesting numerous ways in which you could diagnose your problems *yourself* (ie by *not* expecting everyone else to do you work for you). 3. you tweak one small bit of your code (like as not this causes as many problems as it solves), failing to answer any of the requests for clarification raised by the previous poster, failing to address any of the improvements in your approach that have been suggested, and by the looks of things failing to understand *anything*. 4. goto 1. repeat ad (moltam) nauseam. The only variation from this pattern is when you decide to start a new thread just for the sheer hell of it. Amusingly, you wonder why people lose patience with you. Mark
Post Follow-up to this messageMark Clements wrote: Ok please suggest something to the problem i posted and i try to fix it and come up with a specific question.
Post Follow-up to this messageNikos wrote: > Mark Clements wrote: > > Ok please suggest something to the problem i posted and i try to fix it > and come up with a specific question. You really couldn't make this up.... Here is the information you give: >Hello, iam tryign to convert another script to htm;::template but iam >having some problems: and >At that time yes i would like a little spoonfeeding but the template >its done(i guess its correct since now i have problem with MySQL too >and i cant test it), the only help i need is with the snippet of >games.pl (I have already (in other threads) suggested one way in which MySQL problems can be diagnosed, but since you didn't seem to be interested in following my advice then, I doubt if you will now, and so I won't repeat myself). Anyway (in no particular order): 1. you haven't told us what the expected behaviour is 2. you haven't told us what the *actual* behaviour is. 3. you haven't read the posting guidelines (as you have been asked to do on several occasions). 4. you haven't broken the problem down into the smallest possible piece of code that demonstrates the issue. 5. you haven't told us where the failure is. 6. in short, you have given us *nothing* to go on. Do you really expect us to set up an environment like yours, install your script, run it, and then work through all *your* problems *ourselves*? I don't know whether to laugh or cry. Why do I feel like I'm beating my head against a brick wall? Mark
Post Follow-up to this messageNikos <hackeras@gmail.com> wrote: > Ok please suggest something Give up on programming, you are not suited for it. -- Tad McClellan SGML consulting tadmc@augustmail.com Perl programming Fort Worth, Texas
Post Follow-up to this messageMark Clements <mark.clementsREMOVETHIS@wanadoo.fr> wrote: > Why do I feel like I'm beating my > head against a brick wall? Because you are. :-( (It will feel really good when you stop though. :-) -- Tad McClellan SGML consulting tadmc@augustmail.com Perl programming Fort Worth, Texas
Post Follow-up to this messageNikos wrote: > Ok please suggest something to the problem i posted and i try to fix it > and come up with a specific question. Read the documentation for HTML:Template. The answer to your question is there. Look for the section on TMPL_LOOP. http://search.cpan.org/~samtregar/H...2.7/Template.pm It looks like you are trying to print the data rather than pass it to the template. You want to pass the data to the template, then print the template. The docs for HTML::Template will explain how to do this. I am not going to take the time to try to re-create your database on my system to re-write your code so it works. If there is something specific about the documentation for the TMPL_LOOP tag in the HTML::Template docs, you can ask.
Post Follow-up to this messageTad McClellan wrote: > Give up on programming, you are not suited for it. Iam just trying all these days to convert my cgi.pm database to a html::template. Its just my personal web page, iam not a professional programmer as you already figure out yoursleves. ;-)
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.