Create the template
The default template name for the printable version will
be 1.html . You may define a different default template
for a domain in the MySQL settings for that member.
be 1.html . You may define a different default template
for a domain in the MySQL settings for that member.
The most basic template will use 3 tokens: Page Title is !TITLE!,
URL to original page is !URL!, and the printable content is !CONTENT!
A more fully-featured template which includes both “Print”
and “Close This Window” buttons is included in the
download version of this script.
URL to original page is !URL!, and the printable content is !CONTENT!
A more fully-featured template which includes both “Print”
and “Close This Window” buttons is included in the
download version of this script.
<html><head> <title>!TITLE!</title> <base href="!URL!"></head> <body>!CONTENT! <br><br>Page printed from: !URL! </body> </html>
Beginning the Printer Version script
Create a new file called print.php and start the file with:
<?
A few options need to be set in the beginning.
First are the MySQL server connections.
<?php
//Server Settings
$mysv="localhost"; #your server name
$myun="your MySQL username";
$mypw="your MySQL password";
$mydb="your MySQL database name";
//Connection
$db = mysql_connect($mysv, $myun, $mypw);
mysql_select_db($mydb,$db);
?>
Next we tell the script how many days to cache the printable
HTML content of a webpage. After this many days the script
will go spider the webpage again. If your webpages change
frequently, you may wish to make this a lower number.
HTML content of a webpage. After this many days the script
will go spider the webpage again. If your webpages change
frequently, you may wish to make this a lower number.
<?php
$daystocache = 5;
?>
Next we define what hidden comment tags we will use to grab
the printable content.
the printable content.
<?php
$GrabStart = "<!--startclickprintinclude-->";
$GrabEnd = "<!--endclickprintinclude-->";
?>
You have the option of excluding certain content that is
inside of the printable region. Define the comment tags here.
inside of the printable region. Define the comment tags here.
<?php
$ExcludeStart = "<!--startclickprintexclude-->";
$ExcludeEnd = "<!--endclickprintexclude-->";
?>
This defines what tags we will use to find the webpage title.
<?php
$TitleStart = "<title>";
$TitleEnd = "</title>";
?>