RE: [SMARTY] Printer Friendly format
| From: | Josh Johnson | Date: | Wed, 11 Sep 2002 14:23:26 +0000 |
| Subject: | RE: [SMARTY] Printer Friendly format | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5962@lists.php.net to get a copy of this message | ||
First thing to do would be to make sure that your content and layout are
completely separate from your layout. Keep your user interface in
separate files or something of that nature. Then just make two template
files, one for printer friendly, one for normal. The normal one can call
the interface template files and the print friendly can leave them out,
change the style sheet, etc.
From there I think the easiest way to do it would be to add a query
variable like this: .../August/transylvanian_trousseau.html?print=yes
Then in your page add an if statement that checks if that variable was
passed, and then loads the proper template accordingly.
Ex:
if($_GET[print] == "yes"){
$template = "template_for_print.tpl";
}
else{
$template = "normal_template.tpl";
}
$smarty->display($template);
-- Josh
-----Original Message-----
From: Eric C. Pollitt [mailto:eric@globalhemp.com]
Sent: Tuesday, September 10, 2002 6:05 PM
To: smarty-general@lists.php.net
Subject: [SMARTY] Printer Friendly format
How can I implement a "Printer Friendly" format (template) using Smarty?
My pages have the following format:
<?php require '/home/globalhemp/www/Smarty/Smarty.class.php'; require
'/home/globalhemp/www/Poll/booth.php';
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$smarty->assign("TITLE", "Title information here");
$smarty->assign("DESCRIPTION", "Short description here");
$smarty->assign("KEYWORDS", "some, keywords, here");
$smarty->assign("AUTHOR", "Author, Arthur, Awefur");
$smarty->assign("CONTENT", '
<P CLASS="size2">Lots of HTML content goes here.</P>
');
$smarty->display('/home/globalhemp/www/Smarty/templates/index.tpl');
?>
Example Web page using Smarty:
http://globalhemp.phpwebhosting.com/News/2002/August/transylvanian_trous
seau
.html
NOTE: Current "Print this page" is a slow script that I would like to
replace with something that I'm positive Smarty can do MUCH better.
Basically, what I want to do is to use an alternative template for
$smarty->display.
I would also require that the "Print Friendly" page includes all content
within $smarty->assign("CONTENT", ""); most importantly images. Too many
"Print Friendly" scripts out there assume that all files are in the same
directory as the script and don't properly write paths to the
appropriate
images, etc. The script that I'm using now does this correctly, but uses
Python.
Thanks,
Eric C. Pollitt, Founder
401 E. Illinois Ave.
Peoria, IL 61603
Global Hemp - Portal to the hemp community
http://www.globalhemp.com/
Those who don't like thinking should at least rearrange their prejudices
from time to time.
-- Luther Burbank, 1849-1926
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php