PHPBuilder - Creating a Printer Version Grab Method Page 8



RSS Twitter
Articles Html

Creating a Printer Version Grab Method - Page 8

by: Jim Fletcher
|
April 1, 2004

Finally insert the new data into the database.

<?php
$sql 
"INSERT INTO cache (id,username,url,date,title,body) VALUES 
('','$company','$cacheurl','$date','$titleb','$contentb')"
;
$resultc mysql_query($sql);
?>
Finish up by closing the if expression.

<?php
#end if cache is empty
?>
If the page is in the cache, then set the $showme and $title variables based on the returned data.

<?php
else {

$showme $resultb[1];
$title $resultb[0];

}
?>
Integrate printable content with template
The template content is in the $body variable. We will replace the tokens in the template with the variables in this script.

<?php
$body2 
str_replace("!TITLE!"$title$body);
$body2 str_replace("!URL!"$url$body2);
$body2 str_replace("!COMPANY!"$company$body2);
$body2 str_replace("!HTTP_REFERER!"$HTTP_REFERER$body2);
$body2 str_replace("!CONTENT!"$showme$body2);
$body2 str_replace("!LOGO!"$myrow["logo"], $body2);
$body2 str_replace("!SITENAME!"$myrow["sitename"], $body2);
?>
Show the result
Print the resulting printer version of the webpage and end the print.php script.

<?php
echo $body;

?>

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Jim Fletcher

Comment:



Comment:

(Maximum characters: 1200). You have characters left.