• tp5 前台 点击显示一个弹窗


    例子

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

    }

  • 相关阅读:
    python+opencv 运行环境搭建
    centos 安装 FLEXPART
    centos 安装npm node
    USACO4.3 Street Race【分析】
    USACO4.3 Letter Game【枚举·细节】
    结构体封装高精度 大整数BigInt
    POJ3585 Accumulation Degree【换根dp】
    换根dp特征总结
    HDU2196 Computer【换根dp】
    CF1187E Tree Painting【换根dp】
  • 原文地址:https://www.cnblogs.com/dennyxiao/p/8441482.html
Copyright © 2020-2023  润新知