控制器-简单
~~~
public function search()
{
$type='city';
$res=Db::name('city')->order('zm','asc')->order('sort','asc')->select();
$this->assign('res',$res);
$this->assign('type',$type);
return $this->fetch('search');
}
~~~
控制器-复杂
~~~
public function search(){
$type='brand';
if(input('brand_id')){
$res=model('brandSon')->where('brand_id',input('brand_id'))->select();
$type='son';
}
elseif(input('son_id')){
$res=model('cars')->where('son_id',input('son_id'))->order('sort','asc')->select();
$type='cars';
}
elseif(input('cars_id')){
$res=model('configure')->where('cars_id',input('cars_id'))->select();
$type='configure';
}
else{
$res=model('brand')->order('zm','asc')->order('sort','asc')->select();
}
$this->assign('res',$res);
$this->assign('type',$type);
return $this->fetch();
}
~~~
前端-简单
~~~
<div >
<?php
$zmArr=array();
?>
{foreach name="res" item="vo"}
{if condition="isset($vo.zm)"}
{if condition="!in_array($vo.zm,$zmArr)"}
<span class="item text-center text-red large"><strong>{$vo.zm}</strong></span>
{/if}
<?php
$zmArr[]=$vo['zm'];
?>
{/if}
<a href="{:url('search',[$type.'_id'=>$vo.id])}" brand_id='{$vo.id}' class="item text-center">
{$vo.name}
</a>
{/foreach}
</div>
~~~
前端-多
~~~
<?php
$zmArr=array();
?>
{foreach name="res" item="vo"}
{if condition="isset($vo.zm)"}
{if condition="!in_array($vo.zm,$zmArr)"}
<div ng-repeat="(key,item) in cityList" class="clearboth ng-scope">
<div class="cityList_mainWord_div" id="cityList_mainWord_div_A">
<span ng-bind="key" class="cityList_mainWord ng-binding">A</span>
</div>
{/if}
<?php
$zmArr[]=$vo['zm'];
?>
{/if}
<div class="cityList_mainCity_div">
<div ng-repeat="citem in item" class="cityList_mainCity ng-scope">
<div class="click_city"><span ng-bind="citem.city_name" data-pinyin="ANYANG" class="ng-binding">安阳</span>
</div>
</div>
</div>
</div>
{/foreach}
~~~
- 心灵笔记
- tp5在编辑器一行一个添加信息
- 出库入库处理
- 出库
- 入库
- 后台控制器
- tp5加载更多-流加载
- 配件列表
- Parts.php
- add.html
- edit.html
- 图片管理
- controller
- 1.imgfile.php
- 2.imgfiletag.php
- view
- imgfile
- 1.index.html
- 2.show.html
- 3.simple.html
- 4.more.html
- 5.edit.html
- 6.deittag.html
- imgfiletag
- add.htm
- edit.htm
- model
- imgfile.php
- imgfiletag.php
- api
- upload.php
- js
- admin.js
- tp5整合百度编辑器多图上传
- 1.html代码
- 2.js代码
- 3.api代码
- 4.extend中的拓展代码
- tp5删除图片同时删除服务器图片
- 实用字段的的添加更新
- 根据时间戳获取未来几天星期几
- curl
- 城市按字母排版
- 聚合查询及渲染,处理产品首页
- 过滤字段
- 风控
- 查询id是否在数组里
- 判断更新还是新增操作
- tp5使用引入php文件