<?php global $template; $template = new template(); $template->load_file("head"); $template->load_file("body"); $template->load_file("foot");
ini_set('include_path', $script_root . 'inc' . PATH_SEPARATOR . $script_root . 'inc/lib' . PATH_SEPARATOR . $script_root . 'languages' . PATH_SEPARATOR); include 'functions.inc.php'; include 'template.class.inc.php'; include 'log_downloads.class.inc.php'; include 'language.' . $language . '.inc.php'; /***************************************************** ** Get server info *****************************************************/ if ($debug_mode == 'on') { get_phpinfo(array('Script Name' => $script_name, 'Script Version' => $script_version)); } /***************************************************** ** Load template *****************************************************/ $tpl = new template(); $tpl->load_file('dlcl', $template_file); /***************************************************** ** Take care for older PHP-Versions *****************************************************/ if (isset($HTTP_GET_VARS) and !empty($HTTP_GET_VARS)) { $_GET = $HTTP_GET_VARS; } if (isset($HTTP_POST_VARS) and !empty($HTTP_POST_VARS)) { $_POST = $HTTP_POST_VARS; } if (isset($HTTP_SERVER_VARS) and !empty($HTTP_SERVER_VARS)) { $_SERVER = $HTTP_SERVER_VARS; } if (isset($HTTP_SESSION_VARS) and !empty($HTTP_SESSION_VARS)) { $_SESSION = $HTTP_SESSION_VARS; }
/***************************************************** ** Links always point to the Document URI if exists *****************************************************/ if (isset($_SERVER['DOCUMENT_URI']) and !empty($_SERVER['DOCUMENT_URI'])) { $document_self = $_SERVER['DOCUMENT_URI']; } else { $document_self = $script_self; } /***************************************************** ** Initialyze template class *****************************************************/ $tpl = new template(); /***************************************************** ** Load layout html template *****************************************************/ $tpl->load_file($tplt, $path['templates'] . $tmpl['layout']); /***************************************************** ** Register language file and additional text array *****************************************************/ if (isset($txt) and is_array($txt)) { reset($txt); while (list($key, $val) = each($txt)) { ${$key} = $val; $tpl->register($tplt, $key); } } if (isset($add_text) and is_array($add_text)) { reset($add_text); while (list($key, $val) = each($add_text)) { ${$key} = $val; $tpl->register($tplt, $key);
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /***************************************************** ** List of some example extenstions *****************************************************/ $extension_list = array('bmp', 'dat', 'doc', 'gif', 'html', 'jpg', 'mdb', 'pdf', 'php', 'png', 'ppt', 'rar', 'rtf', 'tar', 'tif', 'txt', 'xls', 'zip', 'tar.gz'); /***************************************************** ** Include template class *****************************************************/ include './inc/template.class.inc.php'; /***************************************************** ** Load template *****************************************************/ $tpl = new template(); $tpl->load_file('global', './templates/test.tpl.html'); /***************************************************** ** Parse global template (mostly for user debugging) *****************************************************/ if (isset($add_text) and is_array($add_text)) { reset($add_text); foreach ($add_text as $key => $val) { ${$key} = $val; $tpl->register('global', $key); } } if (isset($extension_list) and !empty($extension_list) and is_array($extension_list)) { for ($i = 0; $i < count($extension_list); $i++) { $extensions[] = array('EXT' => strtoupper($extension_list[$i]), 'ext' => strtolower($extension_list[$i])); } }
** Filename.....: seperate-script.php ** Author.......: Richard Heyes ** Version......: 1.0 ** Notes........: This shows how you can ** use multiple template files. ** Last changed.: 23/05/00 ** Last change..: ***************************************/ include 'class.template.inc'; /*************************************** ** Set a couple of example variables. ***************************************/ $test_var = 'Hello world!'; $page_title = 'Template Class'; /*************************************** ** Set a couple of example arrays. ***************************************/ $table_rows = array(); $table_rows[] = array('column_1' => 'This is column one on row one!', 'column_2' => 'This is column two on row one!', 'column_3' => 'This is column three on row one!'); $table_rows[] = array('column_1' => 'This is column one on row two!', 'column_2' => 'This is column two on row two!', 'column_3' => 'This is column three on row two!'); /*************************************** ** The template goodies. ***************************************/ $tpl = new template(); $tpl->load_file('header', 'header-template.html'); $tpl->load_file('main', 'main-template.html'); $tpl->load_file('footer', 'footer-template.html'); $tpl->register('header', 'test_var, page_title'); $tpl->parse('header, main, footer'); $tpl->parse_loop('main', 'table_rows'); $tpl->print_file('header, main, footer');
$table_rows[] = array('column_1' => 'This is column one on row two!', 'column_2' => 'This is column two on row two!', 'column_3' => 'This is column three on row two!'); /*************************************** ** Postgres stuff. This was the code I ** used to test the $obj->parse_pgsql() ** method. Worked too. ***************************************/ /* $pg = pg_connect('user=richard dbname=scripts port=5432'); $sqlquery = 'SELECT col1 AS column_1, col2 AS column_2, col3 AS column_3 FROM test'; $table_rows = pg_exec($pg, $sqlquery); */ /*************************************** ** The template goodies, using shortcut ** functions. ***************************************/ $tpl = new template(); $tpl->load_file('complete', 'complete-template.html'); $tpl->parse_loop('complete', 'table_rows'); $tpl->pprint('complete', array('test_var', 'page_title')); /*************************************** ** The template goodies, using the ** longer method. ***************************************/ /* $tpl->load_file('complete', 'complete-template.html'); $tpl->register('complete', 'test_var,page_title'); $tpl->parse('complete'); $tpl->parse_loop('complete', 'table_rows'); $tpl->print_file('complete'); */
<?php global $template; $template = new template(); $template->load_file("404"); ?> Sorry, this page has been removed.
<?php include 'tplutil.inc'; include 'class.template.inc'; $GLOBALS['TITLE'] = 'My Title'; $GLOBALS['USER'] = get_user(); $GLOBALS['users'] = get_users(true); $tpl = new template(); $tpl->load_file('main', 'slides/pragmatic/templateclass.tpl'); $tpl->parse_loop('main', 'users'); $tpl->pprint('main', array('USER', 'TITLE'));