Hey gang,
I'm doing a website for my mom's puppy pillow company (http:.//www.boyosplace.com), and I'm attempting to use HTML::Template and CGI::Application to accomplish a shopping cart/store app.
What I'm running into is when I try to add the product to the cart, the item parameter isn't being coerced (am i using the correct word in this case?) into the template paramater in the TMPL_LOOP from the query string.
sub retrieve { my $self = shift; use Data::Dumper; my $q = $self->query; my $tmpl = $self->load_tmpl( "showitem.html", loop_context_vars =>1, associate => $q); $tmpl->param( product => $self->dbh->selectall_arrayref(q[SELECT ima +ge, price, description, serial FROM product WHERE id=?], { Slice => { +} }, $q->param('item') )); return $frm->build_page( { title => "Boyo's Place: " . $self->dbh-> +selectrow_array(q[SELECT name FROM product WHERE id=?], { Slice => {} + }, $q->param('item') ), output => $tmpl->output } ), $q->code(Dumper +(\$tmpl)); }
<!--TMPL_LOOP name="product"--> <table width="400" border="1" cellspacing="0" cellpadding="3"> <tr> <td><!--TMPL_VAR name="image"--></td> <td align="right">Price: $<!--TMPL_VAR name="price"--></td> </tr> <tr> <td colspan="2" align="justify"><!--TMPL_VAR name="description"--></td> </tr> <tr> <td colspan="2"><a href="?mode=add_to_cart&item=<!--TMPL_VAR n +ame="item"-->&serialn=<!--TMPL_VAR name="serial"-->">add to cart< +/a></td> </tr> </table> <!--/TMPL_LOOP-->
I've tried using Data::Dumper to sort out the $tmpl hash...but to no avail.
Can someone help me?
In reply to CGI::Application/HTML::Template problem by stonecolddevin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |