{* $ bottomshortcutcontent [bst] [bsc] .bscname *} div> td> {* if ($ smarty.section.bsc. Index Mod $ BOTTOMCONTENTNUM) EQ ($ bottomcontentnum-1) *} tr> {* / if *} {* / section *} TABLE> {** SUB End **} td> {* IF ( $ smarty.section.bst.index mod $ bottomtitlenum) EQ ($ bottomtiTlenum-1) *} tr> {* / if *} {* / section *} TABLE> * .php php / ** **************************************** * * FileName: bottomshortcut.php * Author: w01f_dawn * email: dlm364@sohu.com * ************************************************ ******** / / / contains related files Require_once ('./ libs / smarty.class.php'); // class file require_once ('./ include / 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; // connect the database $ dbh_content = new OakDB ($ DBServer, $ DBUser, $ dBPasswd, $ DBName); $ querytext_content = 'Select * from bottomShortcut where bsctitle = /' '. $ Asgnrs_title [' bsctname '].' / '; $ Dbrs_content = $ dbh_content-> querydb ($ querytext_content); // row pointer DBRS // put the database content the value $ [] array while ($ asgnrs_content = mysql_fetch_assoc ($ dbrs_content)) {$ value_temp [] = $ asgnrs_content; echo 1;} $ value_content [] = $ value_temp;} $ smarty-> assign ( 'bottomshortcuttitle', $ value_title); // Template variable replacement content Put $ smarty-> assign ('bottomshircutcontent', $ value_content);
// Compile and display the navigation.tpl template under ./Templates
$ Smarty-> Display ('bt.tpl');
?>
转载请注明原文地址:https://www.9cbs.com/read-78907.html
|