Hi all,
I can't seem to find the phplib package in synaptic. Does anyone know how or
what to get it for kubuntu or am I overlooking something?
I'm trying to learn a php application from a book and for some reason I keep getting this
error:
Warning: include(template.inc) [function.include]: failed to open stream: No
such file or directory in /home/david/www/ch1/listing2.php on line 12
Warning: include() [function.include]: Failed opening 'template.inc' for
inclusion
(include_path=':/home/david/www/ch1:.:/usr/share/php:/usr/share/pear') in
/home/david/www/ch1/listing2.php on line 12
Fatal error: Class 'Template' not found in /home/david/www/ch1/listing2.php on
line 25
I've done a search for phplib on my system but got nothing. I've searched all
over the web for clues to whether I am missing something or my configuration
file is wrong.
I think I'm missing the phplib package, but I just can't find it.
I've pasted the code below:
<?php
// Set PHPLIB path
$PHPLIB_DIR = $_SERVER['DOCUMENT_ROOT'] . '/phplib';
// Add PHPLIB path to PHP's include path
ini_set( 'include_path', ':' . $PHPLIB_DIR . ':' . ini_get('include_path'));
// Include the PHPLIB template class
include('template.inc');
// Setup this application's template directory path
$TEMPLATE_DIR = $_SERVER['DOCUMENT_ROOT'] . '/ch1/templates';
// Setup the output template filename
$OUT_TEMPLATE = 'listing2out.html';
// Get name from GET or POST request
$name = (! empty($REQUEST['name'])) ? $REQUEST['name'] : null;
// Create a new template object
$t = new Template($TEMPLATE_DIR);
// Set the template file for this object to application's template
$t->set_file("page", $OUT_TEMPLATE);
// Setup the template block
$t->set_block("page", "mainBlock" , "main");
// Set the template variable = value
$t->set_var("NAME", $name);
// Parse the template block with all predefined key=values
$t->parse("main", "mainBlock", false);
// Parse the entire template and print the output
$t->pparse("OUT", "page");
?>