What is Web±à³Ì Readers Blog?

    Web±à³Ì Readers Blog¼¯ÖÐÁËWeb×ÊÉî³ÌÐòÔ±µÄ¼¼ÇɺÍʵս¾­Ñ飬º­¸ÇÁËWeb±à³ÌµÄÈ«²¿·¶Î§: 3P(ASP, JSP, PHP) web±à³Ì¼¼Êõ£¬MySQLÊý¾Ý¿â¿ª·¢£¬·þÎñÆ÷ÍøÂ簲ȫºÍDIV+CSS²¼¾ÖµÈ£¬ÌṩһЩÓÅÐãµÄ±à³ÌÔ´Â룬ʹÄúµÄWeb±à³Ìѧϰ֮·¸ü¼Óƽ̹¡£

ä¯ÀÀģʽ: ±ê×¼ | Áбí

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>&nbsp;&nbsp;";
$strpage=$strpage."<a href=".$PHPSELF."?totalnum=".$totalnum."&next_page=".($curr_page+1).$ url.">ÏÂÒ³</a>&nbsp;&nbsp;";
$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)





·Ã¿Í ÆÀÂÛ





·¢±íÆÀÂÛ

êÇ¡¡³Æ (±ØÌî)

ÓÊ¡¡Ïä (±ØÌî)

Íø Õ¾

ÑéÖ¤Âë: (±ØÌî)