喜悦国际村 
» 游客:  注册 | 登录 | 搜索 | 统计 | 帮助

RSS 订阅当前论坛  

喜悦证交所已经关闭

上一主题 下一主题
     
标题: [问题] smarty问题,求助  
 
diefish
新手上路
Rank: 1



UID 81477
精华 0
积分 8
帖子 4
金钱 8 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-10-13
状态 离线
[广告]: q m
smarty问题,求助

问题如下,我用PHP+smarty做了个分页,分页正常显示了,但是内容列表却显示不了,对smarty不甚了解,还请大家指导,我把代码贴出来

<?php
/*
 * Created on 2008-4-7
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
  
include_once("../smarty/temp/Smarty.class.php"); //包含smarty类文件

define("NUM",); //定义每次显示的新闻条数

require('../include/mysql.php');
$smarty = new Smarty(); //建立smarty实例对象$smarty

$smarty->templates_dir "../smarty/china/"//设置模板目录

$smarty->compile_dir "../smarty/templates_c"//设置编译目录

$smarty->cache_dir "../smarty/cache"//设置缓存目录

$smarty->cache_lifetime 60 60 24//设置缓存时间

$smarty->caching false//这里是调试时设为false,发布时请使用true

$smarty->left_delimiter "<{"//设置左边界符

$smarty->right_delimiter "}>"//设置右边界符

$db mysql_connect("$db_server""$db_username""$db_password") or die("数据库连接错误!");
mysql_select_db("$db_name"$db);
mb_internal_encoding("UTF-8");
//silk line list

    //$smarty->caching = false;   

    
$lady_url ="http://192.168.0.141/china/silk.php";
    
$content = array();
    
$pagesize 1;
    
$strQuery=  "SELECT id,line_name,line_upload,line_intro,line_vprice from line_lines where line_show=0 order by id desc";
    
$result mysql_query($strQuery);
    
//结果集

    
$total mysql_num_rows($result);
    
//记录条数

    
$totalpage ceil($total/$pagesize);
    
//总页数

    
$page ceil($_GET["pos"])+1;
    
//当前页

    
$strQuery"limit ".($pagesize * ($page-1)).", ".$pagesize;
    
//语句

    
$idx 0;
    
$result mysql_query($strQuery);
    while (
$row = @mysql_fetch_array($result)) 
{     
        
$array[] = array("id"=>$row["id"],
                         
"name"=>$row["line_name"], 
                         
"price"=> $row["line_vprice"],
                         
'image'=>$row['line_upload'],
                         
'intro'=>$row['line_intro'],
);    
    }
    
$smarty->assign("line_list"$array);
    unset(
$array);
    
$smarty->assign('totalpage',$totalpage);
    
$smarty->assign('lady_url',$lady_url);
    
$smarty->display("silk.tpl",$page);

mysql_close($db);
$smarty->display("../../smarty/china/silk.tpl");
?>
tpl:

<{section name=loop loop=$line_list}>
    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="shtour2">
      <tr>
        <td width="82%" height="20" class="shtour2"><h3><{$line_list[loop].name}></h3></td>
        <td width="18%" align="center" class="STYLE5">$<{$line_list[loop].price}></td>
      </tr>
      <tr>
        <td colspan="2"><table width="590" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="490" height="50" align="left" class="shtour2"><{$line_list[loop].intro}></td>
              <td width="100" rowspan="2" align="center"><img src="../<{$line_list[loop].image}>" width="90" height="60" border="1"></td>
            </tr>
            <tr>
              <td height="20" align="left" class="shtour2">Detail</td>
            </tr>
        </table></td>
      </tr>
    </table>
    <{sectionelse}>
        对不起,没有任何新闻输入!
         <{/section}>
    <br>
    <{pager rowcount=$totalpage limit=1 shift=1 no_first=true separator="|" class_text="pager_text" txt_pos="side"}>
    <p>&nbsp;</p></td>
  </tr>
</table>


 附件: 您所在的用户组无法下载或查看附件
2008-4-8 11:27 AM#1
查看资料  发短消息  顶部
 
diefish
新手上路
Rank: 1



UID 81477
精华 0
积分 8
帖子 4
金钱 8 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-10-13
状态 离线
[推荐阅读] 武汉招聘PHP高级程序员,待遇不错!
…………
没人帮忙看下……
2008-4-8 02:36 PM#2
查看资料  发短消息  顶部
     


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题 | 开通个人空间  


 




Powered by Discuz! 6.1.0  © 2001-2010 Comsenz Inc.
Processed in 0.025698 second(s), 6 queries

(冀ICP备05009913号) 管理员:sadly 邮箱/MSN: sadly@phpx.com QQ:824008(长隐) 清除 Cookies - - Archiver - WAP