Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Printing Tables...

by powerhouse (Friar)
on Mar 06, 2003 at 23:35 UTC ( [id://241035]=note: print w/replies, xml ) Need Help??


in reply to Printing Tables...

Thank you, one and all! What I'm doing is building a shopping cart for my wifes site that I'm building for her.

The information coming out of the database is for each product. I'm doing a search for each product that contains both the correct Category ID and that she has turned "on" in the database using the interface I built for her. Then it is using a while($row = $sth->fetchrow_hashref()) { to create the content of the database. There are two cells for each product in the Header is the name. In the bottom cell right below the header is a picture of the item, the description, retail price and our price. Plus, it says if the product is in stock, if not then says the ETA, and has a link where they can add it to a "watch list" to be notified by email when the product is back in stock. PLUS, if the visitor is logged in AND they are a wholesaler it shows their price too. AND a add to cart link.

The problem I'm having is that since the shopping cart is showing 2 products side by side (4 cells, 2 headers 2 content cells), I'm having difficulty getting the second cell for the product on the left, since I have to create the header of the 1st cell.

I had been thinking of a simple way to do it and I come up with this...(I cannot get it to work so I'm going to contemplate your various ideas)

I've created a counter. If the counter is 0 then it creates the header1 the way it is supposed to. Then for header 2 it adds this: {{headercell2}} Then it creates the content cell 1 with all the data, then it prints the content cell 2 with this {{contentcell2}}
Then finishes. and adds 1 to the counter.

If the counter is 1, then instead of doing the above it just does a switch:
$string_w_data =~ s/{{headercell2}}/$header_information/;
It does that for both the header and content cell, then resets the counter to start over.

I feel like that is a sloppy way to do it, but it SHOULD work, but currently does not.

I'm going to give it one more hack at it, then If I cannot get it to work, I'm going to try each of your examples, to the best of my ability. I'm by no means a Perl Guru, so Some of them are over my head, so I'll have to learn more ;o)

Thank you, again,
Richard

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://241035]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-19 01:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found