IT学习联盟

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
IT学习联盟 门户 文章 php 查看内容

thinkphp文章管理代码

2012-8-18 03:27| 发布者: admin| 查看: 678| 评论: 0

自己封装的方法:
    function wenzhang1($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=1")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang1",$list);
      
       }
    function wenzhang2($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=2")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang2",$list);
      
       }
    function wenzhang3($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=3")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang3",$list);
      
       }
    function wenzhang4($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=4")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang4",$list);
      
       }
    function wenzhang5($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=5")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang5",$list);
      
       }
    function wenzhangxi($chart='',$pid=''){
      $user=D($chart);
     
       $list=$user->where("products_id=".$pid."")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhangxi",$list);
      
       }
    function wenzhangx(){
       $this->wenzhang1('wenzhang');
       $this->wenzhang2('wenzhang');
       $this->wenzhang3('wenzhang');
       $this->wenzhang4('wenzhang');
       $this->wenzhang5('wenzhang');
   
   
    }

后台代码:
在后台代码中加入这句话(调用封装好的方法,上面有)
$this->wenzhangx();

前台显示代码:
<div class="blow">
  <div class="blow_zi">
        <p><strong><a href="#">支付方式</a></strong></p>
          <volist name="wenzhang1" id="vo">
         <p><a href="__URL__/test?id={$vo.products_id}">{$vo.products_name}</a></p>
          </volist>
       
      

  </div><!--blow_zi-->

  <div class="blow_zi">
        <p><strong><a href="#">配送方式</a></strong></p>
       <volist name="wenzhang2" id="vo">
         <p><a href="__URL__/test?id={$vo.products_id}">{$vo.products_name}</a></p>
          </volist>www.2cto.com
  </div><!--blow_zi-->

 


Archiver|IT学习联盟| 网站地图

Powered by Discuz! X2.5© 2001-2010 世界学习室 大伟制作

GMT+8, 2018-5-25 03:23 , Processed in 0.096503 second(s), 12 queries .