#native_company# #native_desc#

Creating a Printer Version Grab Method Page 4

By Jim Fletcher
on April 1, 2004

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.
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.
<base href="!URL!"></head>
<br><br>Page printed from: !URL!
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.


//Server Settings

$mysv="localhost"#your server name

$myun="your MySQL username";

$mypw="your MySQL password";

$mydb="your MySQL database name";


$db mysql_connect($mysv$myun$mypw);



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.




Next we define what hidden comment tags we will use to grab
the printable content.



$GrabEnd "<!--endclickprintinclude-->";


You have the option of excluding certain content that is
inside of the printable region. Define the comment tags here.



$ExcludeEnd "<!--endclickprintexclude-->"


This defines what tags we will use to find the webpage title.



$TitleEnd "</title>"