PHP
/ ****************************************** * * FileName: Bottomshortcut.php * author: w01f_dawn * email: dlm364@sohu.com * ********************************************************* *********** / / contains related files Require_once ('./ libs / smarty.class.php'); // class file require_once ('./ incrude / db.php'); / / Database file
// Native database related data $ dbrserver = 'localhost'; $ dbuser = 'root'; $ dbname = 'ccst'; $ dbpasswd = 'zzzzz'; // Establish a Smarty instance object $ smarty
$ smarty = new smarty (); $ smarty-> template_dir = "./ Templates / Default"; $ smarty-> compile_check = true; $ smarty-> left_delimiter = "{*"; $ smarty-> right_delimiter = "*} "
// Establish Oakdb object $ dbh to query the database, give a given four parameters automatically connected database
// connect the database $ dbh_title = new OakDB ($ DBServer, $ DBUser, $ DBPasswd, $ DBName); // query leftshortcuttitle, return titles $ querytext_title = 'SELECT * FROM bottomshortcuttitle'; $ dbrs_title = $ dbh_title-> queryDB ( $ querytext_title); while ($ asgnrs_title = mysql_fetch_array ($ dbrs_title)) {$ value_title [] = $ asgnrs_title;} $ smarty-> assign ( 'bottomshortcuttitle', $ value_title); // connect the database $ dbh_content = new OakDB ( $ DBServer, $ DBUser, $ dBPasswd, $ DBName); $ querytext_content = 'SELECT * FROM bottomshortcut'; $ dbrs_content = $ dbh_content-> queryDB ($ querytext_content); // row pointer into the content database dbrs // $ value [] array while ($ asgnrs_content = mysql_fetch_array ($ dbrs_content)) {$ value_content [] = $ asgnrs_content;} // template variable replacement content to the section of the navigation.tpl $ smarty-> assign ( 'bottomshortcutcontent', $ value_content; // Compile and display the Navigation.tpl Template under ./Templates
$ Smarty-> Display ('bottomshortcut.tpl');
?>