Results 1 to 2 of 2

Thread: Print page feature

  1. #1
    Join Date
    Feb 2008
    Location
    Winnipeg Canada
    Posts
    23

    Lightbulb Print page feature

    Hi
    With Indexu you can add print feature to every page you want
    Here is the very simple way to do that
    First of all you have to put this code in template "header.html" before </head> tag

    <script language="JavaScript">
    var gAutoPrint = true; // Tells whether to automatically call the print function

    function printSpecial()
    {
    if (document.getElementById != null)
    {
    var html = '<HTML>\n<HEAD>\n';

    if (document.getElementsByTagName != null)
    {
    var headTags = document.getElementsByTagName("head");
    if (headTags.length > 0)
    html += headTags[0].innerHTML;
    }

    html += '\n</HE>\n<BODY>\n';

    var printReadyElem = document.getElementById("printReady");

    if (printReadyElem != null)
    {
    html += printReadyElem.innerHTML;
    }
    else
    {
    alert("Could not find the printReady function");
    return;
    }

    html += '\n</BO>\n</HT>';

    var printWin = window.open("","printSpecial");
    printWin.document.open();
    printWin.document.write(html);
    printWin.document.close();
    if (gAutoPrint)
    printWin.print();
    }
    else
    {
    alert("The print ready feature is only available if you are using an browser.
    Please update your browswer.");
    }
    }
    </script>

    Then , put this code into the template where you want the Print feature will be available (as for me better to detail_link.html, at the top of template)

    <div id="printReady">

    At the end of template place </div>

    Then, add (we have for example detail_link.html template) code to put some link or image for printing option

    <img src="http://www.your_domain.com/path_to_image" alt="print details of website" /> <a href="javascript:void(printSpecial())">Print this Page</a>

    that's all

    If you have any suggestions or questions - don't hesitate to ask, everything is possible with Indexu

  2. #2
    Join Date
    Sep 2007
    Posts
    84

    Default

    WOW I am impressed very good job I will try to implemented asap

Similar Threads

  1. Print link details ?
    By Frank71 in forum Tutorials, Hints & Tips
    Replies: 3
    Last Post: 02-16-2006, 05:42 PM
  2. cannot feature listings ??
    By ideavirus in forum v5.x
    Replies: 4
    Last Post: 05-15-2005, 03:32 AM
  3. Replies: 7
    Last Post: 04-28-2004, 08:21 AM
  4. Please add this feature!!!!!!
    By craven in forum v5.x
    Replies: 0
    Last Post: 07-07-2002, 03:57 PM
  5. Print a link
    By armadinina in forum v3.2
    Replies: 0
    Last Post: 08-30-2001, 04:57 PM

Posting Permissions

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