#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    3
    Rep Power
    0
    How can u make a script which will make the current page a printable one with out me having to make a printable verion of each oage. That would be had if the amount of pages are 100+
    Thank
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Washington, USA
    Posts
    52
    Rep Power
    14
    A dynamic HTML body tag might be one way, just make your link through query string to call the same page with a query string ?printable=1 so when they click they will be shown the printable version of the page instead of the regular one.

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <?
    if($printable == "1") {
    /* body tag below is for printable version, white background and black text (default) */
    ?>
    <body>
    <?
    } else {
    /* body tag below here is for normal body tag */
    ?>
    <body blah blah blah>
    <?
    }
    ?>
    [/code]

    Someone else might have a better idea, this was just a thought that came to my mind

    Hope this helps


    ------------------
    <UL TYPE=SQUARE>
    <LI> TD Scripts
    <LI> Script School
    <LI>php-scripts
    </UL>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    32
    Rep Power
    15
    Hmm.. how about writing a script that takes your html and strip off all the <tags>? would that help?

    scoobydoo
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    USA
    Posts
    1
    Rep Power
    0
    We did this on our site just this week. Because we have a java app that prints really badly, almost all are pages now have an option for a print-friendly alternative.

    How we did it:
    1. All pages were already being created with PHP includes. The content of the page comes from the main include file. Everything else (header, footer, java applet, <meta> tags) is generated from separate files, which are also created as includes and put together in a PHP-enabled HTML file. (what we're calling the "framework" page).

    2. In the framework page, we have a form that assigns the value to $pfv (printer friendly version). The form looks like this:
    <?print "
    <form action='$PHP_SELF' method='POST'>
    <input type='hidden' name='pfv' value='Y'>
    <INPUT type='image' src='printfriendly.gif' border='0'></form>";
    ?>
    So, when a user wants the print-friendly version, thcy click the little image and the print-friendly version loads.
    (You don't have to use an image as the submit, the final line could just be:
    <INPUT type='submit' value='submit'> instead.)

    3. In the framework page, we also put in if/then statements that decide whether to use all the pretty java toys and the graphic junk. That statement looks something like this:
    <?php

    if ($pfv!='Y')
    {
    include('http://MyURL/sidebar.html')
    }
    ?>


    If you want to see this in action: http://w3.incolsa.net/services/automate.html

    email me directly if you have questions...


Similar Threads

  1. Odd problem with a hash and foreach loop
    By quantumechanix in forum Perl Programming
    Replies: 7
    Last Post: December 15th, 2003, 05:06 PM
  2. return NULL problem
    By greekgoddj in forum C Programming
    Replies: 10
    Last Post: August 17th, 2003, 06:54 PM
  3. a few newbie questions
    By Sparky the Fox in forum Python Programming
    Replies: 9
    Last Post: June 25th, 2003, 03:31 PM

IMN logo majestic logo threadwatch logo seochat tools logo