<table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr><td height="25" colspan="3" >{$pageStr}</td></tr>                 <tr>
                        <td colspan="3">
                        {if $row}                    
                        {foreach from=$row item=vv}                     
    <div class="productquery_dolphin">
    <div class="productquery_dolphin_top">
        <div class="fang" style="width:160px;height:116px">
        <div class="picFit" style="width:160px;height:116px">
        <a href="index.php?c=index&m=article_product&id={$vv.id}" target="_self" ><img src="{$vv.imgurl}" style="width:160px;height:116px" border="0" /></a>
        </div>
        </div>
    </div>
    <div class="productquery_dolphin_bottom">
        <a href="index.php?c=index&m=article_product&id={$vv.id}" target="_self" class="prodtitle"   >{$vv.title}</a>
    </div>
</div>
                        {/foreach}
                        {else}
没有信息
{/if}
                                    </td> 
                      </tr>
<tr><td height="25" colspan="3" >{$pageStr}</td></tr>                        </table>
本来是6条信息的
{$pageStr} 放在上面时显示6条
{$pageStr}放在下面时就显示3条

解决方案 »

  1.   

    productlist.html页面{include file='header.html'}
    <link href="{$sty->template_dir}/img/productquery_dolphin.css" rel="stylesheet" type="text/css" />
    <script>
    $(function(){
        $('.menuList').children('.menuNode').each(function(){
            $(this).mouseover(function(){
                $(this).children('.subMenuList').show().parent().siblings().children('.subMenuList').hide();
     $(this).mouseout(function(){
      $(this).children('.subMenuList').hide();
      });
            });    });
    });
    </script><table width="980" height="38" border="0" cellpadding="0" cellspacing="0" background="{$sty->template_dir}/imgbeb/product1.gif">
      <tbody>
        <tr>
          <td align="center" width="250">&nbsp;</td>
          <td 
              style=" padding-left:20px;VERTICAL-ALIGN: middle; PADDING-TOP: 2px"><span><img height="9" src="{$sty->template_dir}/imgbeb/arrow3.jpg" width="9" /> 当前位置 : <a href="Index.asp"> 首页 </a> - 产品展示</span></td>
        </tr>
      </tbody>
    </table><table cellspacing="0" cellpadding="0" width="980" border="0">
      <tbody>
        <tr>
          <td class="bg_display_left" valign="top" align="middle" width="247">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="12"></td>
      </tr>
    </table>
      
      <div class="menuList">
              <table cellspacing="0" cellpadding="0" width="100%" border="0" >
    <tr><td>{literal}
    <style type="text/css">* {
        font-size:14px;
        line-height:20px;
        color:#333;
        list-style:none;
    }
    .menuList {
        width:130px;}
    .menuNode {
        padding-bottom:10px;
    }
    .menuList .menuNode {
        cursor:pointer;
        font-weight:bold;
    }
    .menuList .menuNode .subMenuList {
        display:none;
        font-weight:normal;
        margin:0;
        padding:2px 0 0 10px;;
    }
    <!--
    .STYLE1 {color: #8C8C8C}
    -->
    </style>
    {/literal}{if is_array($rows)}
    {foreach from=$rows item=v key=k}
    <ul class="menuList">
            <li class="menuNode"><a href="index.php?c=index&m=list_product&id={$v.id}" target="_blank" >{$v.name}</a>            <ul class="subMenuList">
    {if (isset($v.child))}
                 {foreach from=$v.child item=vv key=kk}
                    <li>&nbsp;<IMG height=20 src="{$sty->template_dir}/img/class3.gif" width=26 align=absMiddle border=0>&nbsp;<a href="index.php?c=index&m=list_product&id={$vv.id}">{$vv.name}</a><BR></li>  {/foreach}
             {/if}            </ul>        </li>
      
        </ul>
    {/foreach}
    {/if}
    </TABLE></div>
         
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="10"></td>
      </tr>
    </table>
          
      
               <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0">
                <tbody>
                  <tr>
                    <td align="middle" height="56"><a href="index.php?c=index&m=HrDemand"><img height="46" alt="人才招聘" src="{$sty->template_dir}/imgbeb/button_human.jpg" width="212" border="0" /></a></td>
                  </tr>
                  <tr>
                    <td align="middle" height="56"><a href="index.php?c=index&m=Feedback"><img height="46" alt="客户留言" src="{$sty->template_dir}/imgbeb/button_message.jpg" width="212" border="0" /></a></td>
                  </tr>
                  <tr>
                    <td align="middle" height="56"><a href="index.php?c=index&m=aboutus&id=220"><img height="46" alt="联系我们" src="{$sty->template_dir}/imgbeb/button_contact.jpg" width="212" border="0" /></a></td>
                  </tr>
                </tbody>
            </table>

    </td>
          <td valign="top" align="middle" width="733"><table cellspacing="0" cellpadding="0" width="100%" border="0">
            <tbody>
              <tr>
                <td class="text_display" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="226" height="30">&nbsp;<a href='Products.asp'>产品</a>&nbsp;&gt;&gt;&nbsp;所有产品</td>
                    <td width="227">&nbsp;</td>
                    <td width="102">共有 8 个产品</td>
                  </tr>
                  <tr>
                    <td 
                      height="42" colspan="3">
      
      <form action="Payment.asp" method="post" name="Inquire" target="_blank" id="Inquire" >
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          
                          <tr>
                            <td width="100%" height="5" colspan="3"></td>
                          </tr>
        <tr><td height="25" colspan="3" >{$pageStr}</td></tr>
                          <tr>
                            <td colspan="3">
    {if $row}
                            {foreach from=$row item=vv} 
    <div class="productquery_dolphin">
        <div class="productquery_dolphin_top">
    <div class="fang" style="width:160px;height:116px">
    <div class="picFit" style="width:160px;height:116px">
    <a href="index.php?c=index&m=article_product&id={$vv.id}" target="_self" ><img src="{$vv.imgurl}" style="width:160px;height:116px" border="0" /></a>
    </div>
    </div>
    </div>
    <div class="productquery_dolphin_bottom">
    <a href="index.php?c=index&m=article_product&id={$vv.id}" target="_self" class="prodtitle"   >{$vv.title}</a>
    </div>
    </div>
    {/foreach}

    {else}
    没有信息
    {/if}
                </td>
                          </tr>
      <tr><td height="25" colspan="3" >{$pageStr}</td></tr>
                        </table>
                    </form>
    </td>
                  </tr>
                  <tr>
                    <td height="1" colspan="3"><table align='center'></table>
                    </td>
                  </tr>
                </table></td>
              </tr>
            </tbody>
          </table>
              <table cellspacing="0" cellpadding="0" width="707" border="0">
                <tbody>
                  <tr>
                    <td><img height="1" src="{$sty->template_dir}/imgbeb/line_display.jpg" width="707" /></td>
                  </tr>
                  <tr>
                    <td align="right" height="32"><a href="#"><img height="12" src="{$sty->template_dir}/imgbeb/button_up.jpg" width="37" border="0" /></a></td>
                  </tr>
                </tbody>
            </table></td>
        </tr>
      </tbody>
    </table>{include file='footer.html'}
      

  2.   

    indexaction.class.php 页面class indexAction extends baseAction{
        function list_product(){


     $cate = new cateModel;
         $rows = $cate->getAll('fid=97'); if($rows){
      foreach($rows as $k=>$v){
    $child = $cate->getAll("fid={$v['id']}");
    if($child){
      $rows[$k]['child'] = $child;

    }
    }

    }  
     if(isset($_GET['id']));//获取大类下面的子类
     $id = $_GET['id'];
     $cate = new cateModel;  $row = $cate->getAll($condition = "fid =$id");
     if($row){
      foreach($row as $k=>$v){
    $child = $cate->getAll("fid={$v['id']}");
    if($child){
      $row[$k]['child'] = $child;

    }
    }

    }
     if($row){//如果有子类,则把本身及其所有子类的id赋给$_id
        $_id = $id.',';
    $_id .= Tool::arrOfStr($row,'id');


    }else{//如果没有子类则把本身的(传过来的id)赋给$_id
    $_id = $id;
     }  
    $news = new newsModel;
    $condition = "cate IN($_id)";
    $dangqian = isset($_GET['page'])?intval($_GET['page']):1;
    $dangqian = $dangqian<=0?1:$dangqian;
    $yiye = 1;
    $left =($dangqian-1)*$yiye;
    $news->query("SELECT id FROM $news->table WHERE cate IN($_id)"); $page = new page;
    $pageStr = $page->out($news->affected_rows(),$yiye);
    $row = $news->getAll($condition,$order = "id DESC","$left,$yiye");



    $this->view->assign('pageStr',$pageStr);
    $this->view->assign('row',$row);
     
         $this->view->assign('rows',$rows);
         $this->view->display('productlist.html');
         }
    }