Web±à³Ì Readers Blog
create the blog for Web±à³Ì scholars
adodb+smarty+mysql+phpµÄ·ÖҳʵÀý
Submitted by ×÷Õß: admin
2008-07-16 12:24:57
adodb+smarty+mysql+phpµÄ·ÖҳʵÀý
³ÌÐòÒ³Ãæ smarty_adodb_page.php
| ÒÔÏÂÊÇ´úÂ룺 <?php include "class/Smarty.class.php"; include('include/adodb/adodb.inc.php'); $smarty = new Smarty(); $smarty->template_dir = "ex_tpl";//ÉèÖÃÄ£°åĿ¼ $smarty->compile_dir = "templates_c"; //ÉèÖñàÒëĿ¼ $smarty->left_delimiter = "<{"; $smarty->right_delimiter = "}>"; $dbdriver="mysql"; $server="IpµØÖ·"; $user="Óû§Ãû"; $password="ÃÜÂë"; $database="Êý¾Ý¿âÃû"; $db = &ADONewConnection($dbdriver); // eg 'mysql' or 'postgres' $db->debug = true; $db->Connect($server, $user, $password, $database); /********************smarty_adodb_page.php******************************* º¯ÊýÃû£ºfenpagenew£¨£© ¹¦ÄÜ£ºÊµÏÖ¡¡smarty+adodb¡¡µÄ·ÖÒ³ ÌØ±ð˵Ã÷:url1²ÎÊý±äÁ¿ÊÇ·½±ã´øÒ»Ð©×Ö¶ÎÓÃÉÏÒ³ºÍÏÂÒ³µÄ³¬¼¶Á´½Ó·½Ê½ ͨ¹ýµØÖ·À¸Ä¿´«Öµ ×÷Õß:skyfen 2007Äê11ÔÂ23ÈÕ **********************************************************************/ function fenpagenew($sql1,$PHPSELF1,$fenpage1,$url1) { global $conn; global $curr_page; $sql=$sql1; $PHPSELF=$PHPSELF1; $fenpage=$fenpage1; $url=$url1; $strpage=""; if (isset($_REQUEST['next_page'])) $curr_page = $_REQUEST['next_page']; if (empty($curr_page)) $curr_page = 1; $strpage=$strpage."<table border=0 cellspacing=0 cellpadding=0 width=100%><tr bgcolor=#eeeeee><td align=right height=25>"; $strpage=$strpage."<a href=".$PHPSELF."?totalnum=".$totalnum."&next_page=".($curr_page-1).$ url.">ÉÏÒ³</a> "; $strpage=$strpage."<a href=".$PHPSELF."?totalnum=".$totalnum."&next_page=".($curr_page+1).$ url.">ÏÂÒ³</a> "; $strpage=$strpage."</td></tr></table>"; return $strpage; } /********************************************/ $PHPSELF="page_smarty_adodb.php"; $sql='select * from tb_news_ch'; $rs=$db->Execute($sql,$pagesize,$page); $fenpagenum = 5; $strpage=fenpagenew($sql,$PHPSELF,$fenpagenum,$url1); $rs = $db->PageExecute($sql,$fenpagenum,$curr_page); $i=0; while (!$rs->EOF) { $input_out_cotent.=$rs->fields[1]."<br>"; $i++; $rs->MoveNext(); } $smarty->assign('num_page2',$strpage); $smarty->assign('input_out_cotent',$input_out_cotent); $smarty->display("smarty_adodb_page_class.html"); ?> |
Ä£°åÎļþ¼Ðex_tplϱߵľ²Ì¬Ä£°å smarty_adodb_page_class.htmlµÄÄÚÈÝ:
| ÒÔÏÂÊÇ´úÂ룺 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>smarty_adodb_page_class.php</title> </head> <body> <{$num_page2}> <{$input_out_cotent}> <{$num_page2}> </body> </html> |
·ÖÀà:ÍøÕ¾|PHPѧϰ |
Read more
ÔĶÁ (623)
ÆÀÂÛ (5)
·Ã¿Í ÆÀÂÛ
·¢±íÆÀÂÛ
Óû§µÇ¼
ÈÕÖ¾·ÖÀà©®Category
- ÍøÕ¾|PHPѧϰ [63]
- ÍøÕ¾|ASP±¸Íü [6]
- ÍøÕ¾|JSP½ø½× [3]
- ÍøÕ¾|Êý¾Ý¿âÀà [11]
- С̸|ддÐÄÇé [12]
- ÍøÕ¾|xmlѧϰ [0]
- ÍøÕ¾|Javascriptѧϰ [5]
- ÍøÕ¾|ÃæÏò¶ÔÏó [1]
- ÍøÕ¾|AJAXѧϰ [2]
- ÍøÕ¾|ÔÓÆßÔÓ°Ë [9]
- ÍøÕ¾|½¨Õ¾ÖªÊ¶Í¨µÀ [6]
- ÖÐÇï½Ú|´óÔÓ»° [11]
ÈȵãÎÄÕ©®Articles
- ÔÚTomcatÏÂJSP¡¢Se...
- ²ÉÓÃutf8±àÂë³¹µ×½...
- ÎҵĴóѧͬѧ»ØÒäÂ...
- mysqlÊý¾Ý¿âµÄµ¼Èë...
- ¸Ðл×î½üÔÚѧϰÉϰ...
×îÐÂÎÄÕ©®Articles
- ÎåÄêÀ´ÁË,ÎÒÈÔÔÚÍø...
- MVCÉè¼ÆÄ£Ê½/Ä£Ð͵...
- PHP MySQLÊÂÎñ´¦Àí...
- PHP²Ù×ÝMySQL´æ´¢¹ý³Ì
- PHP,MySQLÊÓͼµÄÓ¦ÓÃ
×îÐÂÆÀÂÛ©®Comments
- Õâ¸ö²»ºÃ˵,Google...
- ½ñÌìÖµµÃÇì×££¡£¡£¡
- àÅ. ÎÒÓùýÁËmysql...
- Äã¿ÉÒÔÊÔÊÔMySQL¿Í...
- ÎÒÒ²¾õµÃÓÐÒâ˼²Å°...