SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic Printing

    OK, I didn't know where to post this so I posted it here since I am
    using PHP to do it.

    What I have is a long list of names, address's, etc....

    What I need to do is have it print only so many per page, say 5.

    I can't have it cut off half way through someones information, and
    have the rest of it on the next page.

    Can anyone help me out?

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2001
    Location
    Oregon, USA
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, if you're retrieving from a database, you can build that into your query.. use a GET variable to adjust the 'offset' of the database.

    otherwise, keep a counter that starts on a GET variable value & goes until that + 5.

  3. #3
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I just show 5 results per page, print it automaticaly, then go to the next page with the next 5 results?

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    er, yes - lol

  5. #5
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is also a CSS style that will cause a page break. So you could do is print that line in your while loop (while you are pulling records out).

    So let's say that the record counter you use mod 5 = 0 then echo out the css line.

    I put this in at the end so you can't see it.

    PHP Code:
     <H6 STYLE="page-break-after:always"><font color="#FFFFFF">end</font></H6
    This is cool because you can print out all the records on one page rather than loading page after page and printing each one.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  6. #6
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome deuce868, exactly what I wanted. Thanks!

  7. #7
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But that fore mentioned page break isn't much use with IE browsers.

    Been there, done that, and for the life of me, I couldn't get the pages printing properly.

    In fact, there was a massive discussion about this over at www.siteexperts.com a while back, and no body managed to solve it either.

    MS and Netscape and Opera still need to work on that one.

  8. #8
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use it for intranet apps on several different pages using IE5 & 6
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  9. #9
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What sort of apps ? I tried this to output people's CV that spanned 2 pages, 3 in some cases and the page breaks didn't work.

    The paragraphs were split between the 2 pages, i.e. bottom of page on one page, and top of page on the other; where as it should have printed the paragraph on the second page. 8(

    A shame also, that CSS doesn't give the option to shrink a page to fit; as you can do so with Word in Windows, aye ?

    This would be a bonus - maybe we could have it for CSS Level 4 or something ? LoL

  10. #10
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it has to fit inside the one page as it only breaks after that one point. All of my things are lists of 1 page items. I have used it in mail merges that are one page memos, on mail lerges to sheets of labels where I set up the page to line up with a label sheet so at the end I break for the next sheet of labels.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  11. #11
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ummm.... Then why has my paragraphs split ? Shouldn't the page break push the paragraph to the next page - I assume this should happen, no ?

  12. #12
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, it won't push a paragraph. This line only breaks right then and there...it will not help adjust a page. What I use it for is all of my content fits on one page. Then I repeat it. So I create a one page form...the put it in a while loop to loop through to print that form for many people out of the database. When I print that line is at the end of each form and causes the next persons form to be on the next page. If my form went to long it would not break it properly.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •