控制器-簡單
~~~
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文件