亚洲精品中文字幕无乱码_久久亚洲精品无码AV大片_最新国产免费Av网址_国产精品3级片

php語言

thinkPHP實現(xiàn)的聯(lián)動菜單功能

時間:2024-10-03 05:09:52 php語言 我要投稿
  • 相關(guān)推薦

thinkPHP實現(xiàn)的聯(lián)動菜單功能

  文章主要介紹了thinkPHP實現(xiàn)的聯(lián)動菜單功能,結(jié)合實例形式分析了thinkPHP聯(lián)動菜單的實現(xiàn)步驟與具體操作技巧,需要的朋友可以參考下.

  本文實例講述了thinkPHP實現(xiàn)的聯(lián)動菜單功能。分享給大家供大家參考,具體如下:

  聯(lián)動菜單,首先給你看看前端是怎么寫的:

  <p id="newCat">

  <p class="all_type" id="allGoogsCat">所有商品分類</p>

  <p class="spfl-warp <?php if(CONTROLLER_NAME != 'Index' || ACTION_NAME != 'index'){echo 'hide';} ?> ">

  <p class="index-spfl-left" id="pCatList">

  <ul>

  <foreach name="category_menu" key="one" item="v">

  <li class="li{$one+1}">

  <span><em></em>

  <a href="{:U('Category/index',array('id'=>$v['category_id'],'level'=>1))}" rel="external nofollow" >{$v.category_name}</a>

  </span>

  <p class="p none">

  <foreach name="v['childs']" key="two" item="v2">

  <dl>

  <dt>

  <a href="{:U('Category/index',array('id'=>$v2['category_id'],'level'=>2))}" rel="external nofollow" >{$v2.category_name}</a>

  </dt>

  <dd class="fl">

  <foreach name="v2['childs']" item="v3">

  <a href="{:U('Category/index',array('id'=>$v3['category_id'],'level'=>3))}" rel="external nofollow" >

  {$v3.category_name}

  </a>

  </foreach>

  </dd>

  <p class="cl"></p>

  </dl>

  </foreach>

  </p>

  </li>

  </foreach>

  </ul>

  </p>

  </p>

  </p>

  <script type="text/javascript">

  <?php if(CONTROLLER_NAME != 'Index' || ACTION_NAME != 'index'){ ?>

  //商品分類鼠標(biāo)滑過

  function spflHover() {

  $(".index-spfl-left ul li").live("mouseover", function () {

  $(this).addClass("active").siblings().removeClass("active");

  $(".index-spfl-left").find(".p").hide();

  $(this).find(".p").show();

  }).live("mouseout", function () {

  $(this).removeClass("active");

  $(".index-spfl-left").find(".p").hide();

  $(this).find(".p").hide();

  });

  //鼠標(biāo)滑過分類顯示

  $("#newCat").mouseover(function () {

  $(".spfl-warp").show();

  }).mouseout(function () {

  if ($("#ismain").val() == "1") {

  $(".spfl-warp").show();

  } else {

  $(".spfl-warp").hide();

  }

  })

  }

  spflHover();

  <?php } ?>

  </script>

  看到?jīng)]有,其實里面的一級菜單對應(yīng)二級菜單都是在同一個li里面的,li里面的二級三級呢,都是放在dl的dt和dd標(biāo)簽里面;

  然后現(xiàn)在我們看看取出來的category_menu,什么樣的數(shù)據(jù):

  ?

  1

  2

  3

  4

  5

  6

  7

  8

  9

  10

  11

  12

  13

  14

  15

  16

  17

  18

  19

  20

  21

  22

  23

  24

  25

  26

  27

  28

  29

  30

  31

  32

  33

  34

  35

  36

  37

  38

  39

  40

  41

  42

  43

  44

  45

  46

  47

  48

  49

  50

  51

  52

  53

  54

  55

  56

  57

  58

  59

  60

  61

  62

  63

  64

  65

  66

  67

  68

  69

  70

  71

  72

  73

  74

  75

  76

  77

  78

  79

  80

  81

  82

  83

  84

  85

  86

  87

  88

  89

  90

  91

  92

  93

  94

  95

  96

  97

  98

  99

  100

  101

  102

  103

  104

  105

  106

  107

  108

  109

  110

  111

  112

  113

  114

  115

  116

  117

  118

  119

  120

  121

  122

  123

  124

  125

  126

  127

  128

  129

  130

  131

  132

  133

  134

  135

  136

  137

  138

  139

  140

  141

  142

  143

  144

  145

  146

  147

  148

  149

  150

  151

  152

  153

  154

  155

  156

  157

  158

  159

  160

  161

  162

  163

  164

  165

  166

  167

  168

  169

  170

  171

  172

  173

  174

  175

  176

  177

  178

  179

  180

  181

  182

  183

  184

  185

  186

  187

  188

  189

  190

  191

  192

  193

  194

  195

  196

  197

  198

  199

  200

  201

  202

  203

  204

  205

  206

  207

  208

  209

  210

  211

  212

  213

  214

  215

  216

  217

  218

  219

  220

  221

  222

  223

  224

  225

  226

  227

  228

  229

  230

  231

  232

  233

  234

  235

  236

  237

  238

  239

  240

  Array

  (

  [0] => Array

  (

  [category_id] => 84

  [category_name] => 家裝主材

  [parent_id] => 0

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  [0] => Array

  (

  [category_id] => 85

  [category_name] => 廚衛(wèi)

  [parent_id] => 84

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  [0] => Array

  (

  [category_id] => 99

  [category_name] => 廚盆/水槽

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [1] => Array

  (

  [category_id] => 98

  [category_name] => 衛(wèi)浴配件

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [2] => Array

  (

  [category_id] => 97

  [category_name] => 衛(wèi)浴龍頭

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [3] => Array

  (

  [category_id] => 96

  [category_name] => 龍頭

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [4] => Array

  (

  [category_id] => 95

  [category_name] => 淋浴房

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [5] => Array

  (

  [category_id] => 94

  [category_name] => 智能坐便器

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [6] => Array

  (

  [category_id] => 93

  [category_name] => 浴室柜

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [7] => Array

  (

  [category_id] => 92

  [category_name] => 坐便器

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [8] => Array

  (

  [category_id] => 91

  [category_name] => 浴霸

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [9] => Array

  (

  [category_id] => 90

  [category_name] => 地漏

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [10] => Array

  (

  [category_id] => 89

  [category_name] => 坐便器蓋板

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [11] => Array

  (

  [category_id] => 88

  [category_name] => 洗面盆

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [12] => Array

  (

  [category_id] => 87

  [category_name] => 角閥

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [13] => Array

  (

  [category_id] => 100

  [category_name] => 衛(wèi)浴五金

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [14] => Array

  (

  [category_id] => 101

  [category_name] => 廚房掛件/配件

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [15] => Array

  (

  [category_id] => 86

  [category_name] => 淋浴花灑

  [parent_id] => 85

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  )

  )

  [1] => Array

  (

  [category_id] => 126

  [category_name] => 墻紙

  [parent_id] => 84

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  [0] => Array

  (

  [category_id] => 130

  [category_name] => 3D墻紙

  [parent_id] => 126

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [1] => Array

  (

  [category_id] => 129

  [category_name] => 純紙墻紙

  [parent_id] => 126

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

  [2] => Array

  (

  [category_id] => 128

  [category_name] => PVC墻紙

  [parent_id] => 126

  [listorder] => 200

  [display] => 1

  [childs] => Array

  (

  )

  )

【thinkPHP實現(xiàn)的聯(lián)動菜單功能】相關(guān)文章:

wps怎樣使用開始菜單功能10-31

如何在java中實現(xiàn)左右鍵菜單10-30

php實現(xiàn)圖片縮放功能類08-17

利用python實現(xiàn)簡單爬蟲功能09-25

怎么使用word2013菜單選項功能11-12

ThinkPHP中自動驗證07-26

CSS如何實現(xiàn)中英文雙語菜單效果代碼06-01

純css實現(xiàn)藍(lán)色圓角效果水平導(dǎo)航菜單代碼07-10

PHP實現(xiàn)搜索查詢功能的方法技巧08-01

java實現(xiàn)后臺自動發(fā)郵件功能08-06