例子
1.静态
<div id="wrapper">
<div id="container" style="height: 702px;">
{foreach name="recruitment" item="vo"}
<div class="grid" style=" 174px;float:left">
<strong>{$vo.special}</strong>
<p>工作职责:</p>
<p>{$vo.description}</p>
<a href="javascript:;" onclick="return openWind('{$vo.special}','800','500','getData?id={$vo.id}')">
<div class="meta">点击查看>>></div></a>
</div>
{/foreach}
</div>
</div>
2.js
<script type="text/javascript" src="/static/home/js/jquery.min.js"></script>
<script src="/static/home/js/jquery.lazyload.min.js" type="text/javascript"></script>
<script language="javascript" src="/static/home/js/lhgdialog.min.js"></script>
<script src="/static/home/js/blocksit.min.js"></script>
function openWind(tit,w,h,url)
{
$.dialog({
title:tit,
w+"px",
height:h+"px",
content:'url:'+url,
fixed:false
});
}
3.控制器内
namespace apphomecontroller;
use apphomemodelRecruitmentModel;
use thinkController;
use thinkDb;
class Recruitment extends Base
{
public function recruitment(){
$recruitment = Db::name('recruitment')->select();
$this -> assign('recruitment',$recruitment);
return $this->fetch();
}
public function getData(){
$id = input('param.id');
$model = new RecruitmentModel();
$result = $model->getIntro($id);
$this->assign('result',$result);
return $this->fetch();
}
}
4.模型内
namespace apphomemodel;
use thinkModel;
use thinkDb;
class RecruitmentModel extends Model
{
public function getKuang($id){
$goods = $this->where('id',$id)->find();
}
public function getIntro($id){
return Db::name('recruitment')->where('id',$id)->find();
}
}