converting games.pl(cgi.pm) => games.pl (html::template)

N

Nikos

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>ΜποÏείς να επικοινωνήσεις μαζί μου στο (e-mail address removed)</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?
 
M

Mark Clements

Nikos said:
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*?
 
N

Nikos

Mark said:
<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.
 
M

Mark Clements

Nikos said:
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
 
N

Nikos

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.
 
M

Mark Clements

Nikos said:
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
 
T

Tad McClellan

Mark Clements said:
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. :)
 
S

Scott Bryce

Nikos said:
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/HTML-Template-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.
 
N

Nikos

Tad said:
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. ;-)
 
F

Fabian Pilkowski

* Nikos said:
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
 
M

Mark Clements

Nikos said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top