Results 1 to 8 of 8

Thread: "print this page" ?

  1. #1
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation "print this page" ?

    ... I've done some reasearch and I came out with nothing... I need to know how to build a script, also known as 'PRINT THIS PAGE' script...
    I really have no idea on how to start...
    Can any1 point me in the right direction?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That totally depends on what you want, and has very little to do with PHP.

    Basically, just link to a printer friendly copy of the page. If you want to go through all the effort, this page could, in fact, be PHP generated, I suppose.

    Aside from that, there are some ways to try to make the printer print by javascript command and other ways of assigning a different 'printing' document. Look on the DD scripts library for both... I think.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    from what you're saying...if there is a easier way...I'll chose what you call 'printer friendly copy'...there are php functions that help me to somehow 'clear' the junks from the original web address, or I just...have to build it?

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Basically, you would have to build the page with no advertisements, extra little images/items that would cause a printer to use a lot of ink, and other items that people just don't want to print. As far as php functions go, I don't know of any pre-defined functions that would clear all the junk from the original page. You could probably make something using preg_replace or some other items like that.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'd actually suggest you to use css, that'd make it a lot easier. You could use display: none;

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That may be helpful.

    the only wayt that PHP would help in actually generating the page would be a complex html-parsing script. This is something that would be a challenge to some (if not all) of the best coders here... not just a quick fix. It's certainly possible and easy to theorize... just hard in practice. Mainly, you'd have to program the PHP to know when something should/should not be shown, and how!
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok guys. I managed to a print-friendly page, somehow generated by php, it's actually easy... no images...just the news...
    I've used
    Code:
    <body onload='window.print()'>
    also
    Code:
    <span onclick='javascript:window.print();' class='detaliilnk'>Re-print</span>
    ...I got it... thanks guys...

  8. #8
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Glad to hear it's working for you; and also, thanks for posting your solution. I'm sure it may come in handy for other users to these forums.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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
  •