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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.