媛媛*小怪兽
If you have choices,choose the best! If you have no choices,do the best! 人生就是不断在学习路上进步的!!!!!!

例子

1.静态

<div id="wrapper">
<div id="container" style="height: 702px;">
{foreach name="recruitment" item="vo"}
<div class="grid" style="width: 174px;float:left">
<strong>{$vo.special}</strong>
<p>工作职责:</p>
<p>{$vo.description}</p>
<a href="javascript:;" onclick="return openWind(&#39;{$vo.special}&#39;,&#39;800&#39;,&#39;500&#39;,&#39;getData?id={$vo.id}&#39;)">
<div class="meta">点击查看&gt;&gt;&gt;</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,
width:w+"px",
height:h+"px",
content:'url:'+url,
fixed:false
});
}

 3.控制器内

namespace app\home\controller;
use app\home\model\RecruitmentModel;
use think\Controller;
use think\Db;

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 app\home\model;
use think\Model;
use think\Db;

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();
}

}

 

posted on 2018-02-11 15:04  媛味君  阅读(390)  评论(0编辑  收藏  举报