thinkphp学习2

16.截断字符串

{:dsubstr("$arrData[title]",0,35)}

 

 

17.多表串联-------------执行最后一条语句

$co_p    =  M("company");     

     $company=$co_p->table('think_company a,think_job b')->where('a.account=b.account')->

     field('b.itemid,a.companyName')->order('a.userid desc' )->group("b.account")->limit(36)->select();

    // echo $co_p->getLastSql();

     $this->assign('company',$company);

 

19.URL

$this->assign("jumpUrl",CFG_URL."/member/index.php/Resume/resumestudy");

 

20.数据库没有就给一个默认的值。

{$list[tit]|default="对不起,没有值。"}

 

21.引入标签   引入文件

<tagLib name="data"/>

<include file="Public:head">

 

22.引入JS 引入Css

<load href="LIST_P/Js/Common.js" /> 

<load href="LIST_P/Css/common.css" /> 

{load: LIST_P/Css/common.css } 

{load: LIST_P/Js/common.js } 

 

23.volist标签的妙用

 

24.Tp里面只读取表的id

->field(id)->select();

 

25.TP里面的分页

public function fenye(){

$fenye=M("fenye");

// import("Admin.ORG.Page");

import("@.ORG.Page");

$count=$fenye->count();

$Page   = new Page($count,6); 

$list =$fenye->order('id')->limit($Page->firstRow.','.$Page->listRows)

posted @ 2012-09-25 17:22  longailili  阅读(150)  评论(0)    收藏  举报