Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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

In reply to Re: Printing Tables... by powerhouse
in thread Printing Tables... by powerhouse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found