Home > Archive > PERL Miscellaneous > April 2005 > converting games.pl(cgi.pm) => games.pl (html::template)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
converting games.pl(cgi.pm) => games.pl (html::template)
|
|
|
| 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?
| |
| Mark Clements 2005-04-27, 8:57 pm |
| Nikos 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*?
| |
|
| Mark 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.
| |
| Mark Clements 2005-04-27, 8:57 pm |
| Nikos 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
| |
|
| 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.
| |
| Mark Clements 2005-04-27, 8:57 pm |
| Nikos 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
| |
| Tad McClellan 2005-04-27, 8:57 pm |
| Nikos <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
| |
| Tad McClellan 2005-04-27, 8:57 pm |
| Mark 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
| |
| Scott Bryce 2005-04-27, 8:57 pm |
| Nikos 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.
| |
|
| Tad 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. ;-)
| |
| Fabian Pilkowski 2005-04-28, 3:59 am |
| * Nikos schrieb:
> Mark Clements 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
Whence you know your script rocks the boat since you cannot testing it?
Why not fixing your MySQL server first?
Why not using an alternative data source for testing (when no database
is available for the moment)?
regards,
fabian
| |
| Mark Clements 2005-04-28, 4:00 am |
| In-Reply-To: <d4p5ms$gfv$1@nic.grnet.gr>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 26
Message-ID: <42707f5f$0$25046$8fcfb975@news.wanadoo.fr>
Organization: les newsgroups par Wanadoo
NNTP-Posting-Date: 28 Apr 2005 08:14:57 CEST
NNTP-Posting-Host: 83.197.44.49
X-Trace: 1114668897 news.wanadoo.fr 25046 83.197.44.49:1394
X-Complaints-To: abuse@wanadoo.fr
Xref: number1.nntp.dca.giganews.com comp.lang.perl.misc:571272
Nikos wrote:
> Tad McClellan wrote:
>
>
>
> 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. ;-)
>
>
Most of us *are* professional programmers. The amount of work you want
doing for you exceeds what can reasonably be expected of us: this has
been pointed out by several posters on several occasions. You are being,
quite simply, rude. In effect, your problems (or what we can divine of
them using our telepathic powers, since you never state them clearly),
are very probably quite simple to solve, but you have refused to attempt
any diagnosis despite the myriad methods that have been suggested to
you. I reckon another two hours should do it: you can have a special
rate of 147EUR per hour, though I'll guess I've already spent an hour
typing replies to you and sobbing quietly in the corner. Asking me for
more help implies acceptance of these terms.
Mark
|
|
|
|
|