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

Discussion in 'Perl Misc' started by Nikos, Apr 27, 2005.

  1. Nikos

    Nikos Guest

    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>ΜποÏείς να επικοινωνήσεις μαζί μου στο </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?
    Nikos, Apr 27, 2005
    #1
    1. Advertising

  2. 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, Apr 27, 2005
    #2
    1. Advertising

  3. Nikos

    Nikos Guest

    Mark Clements wrote:
    > 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*?



    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.
    Nikos, Apr 27, 2005
    #3
  4. 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, Apr 27, 2005
    #4
  5. Nikos

    Nikos Guest

    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.
    Nikos, Apr 27, 2005
    #5
  6. 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
    Mark Clements, Apr 27, 2005
    #6
  7. Nikos <> wrote:

    > Ok please suggest something



    Give up on programming, you are not suited for it.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Apr 27, 2005
    #7
  8. Mark Clements <> 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
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Apr 27, 2005
    #8
  9. Nikos

    Scott Bryce Guest

    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/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.
    Scott Bryce, Apr 27, 2005
    #9
  10. Nikos

    Nikos Guest

    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. ;-)
    Nikos, Apr 28, 2005
    #10
  11. * Nikos schrieb:
    > Mark Clements wrote:
    >>
    >> 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


    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
    Fabian Pilkowski, Apr 28, 2005
    #11
  12. Nikos wrote:
    > 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. ;-)
    >
    >

    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
    Mark Clements, Apr 28, 2005
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Theis
    Replies:
    2
    Views:
    453
    Chris Theis
    Jul 24, 2003
  2. Delaney, Timothy C (Timothy)

    RE: Python in Games (was RE: [Stackless] Python in Games)

    Delaney, Timothy C (Timothy), Jun 14, 2005, in forum: Python
    Replies:
    3
    Views:
    277
  3. Josef 'Jupp' Schugt

    (Ab)using class CGI as non-CGI HTML generator?

    Josef 'Jupp' Schugt, Mar 5, 2005, in forum: Ruby
    Replies:
    3
    Views:
    217
    Lee Braiden
    Mar 6, 2005
  4. Mr I
    Replies:
    13
    Views:
    337
  5. Nikos
    Replies:
    4
    Views:
    157
    Nikos
    Apr 26, 2005
Loading...

Share This Page