<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 在首頁模板中獲取所有的產品分類 View: 在網站經常要用到調用所有的欄目,包含下級分類的方法,這個是框架沒有的,需要自己寫方法實現 > \themes\hx\portal\index.html <div class="gzcx_k_nr clearfix"> <div class="gzcx_k_nr_l"> <h4>產品中心</h4> <div class="panel-group wrap" id="accordion" role="tablist" aria-multiselectable="true"> <php>getCategoryAll(26);</php> </div> <div class="gzcx_k_nr_l_dh"> 24小時服務熱線 <span>{$theme_vars.last_kfrx|default=''}</span> </div> </div> <div class="gzcx_k_nr_r"> <ul class="clearfix"> <php> $cid=""; $arr = json_decode(\app\portal\service\ApiService::allSubCategoriesCid(26),true); foreach ( $arr as $key => $val) { if( is_array($val) ) foreach( $val as $value) $cid.= $value.','; } if(!$cid){ $cid=26; } </php> <portal:articles limit="6" order="post.published_time DESC" categoryIds="$cid"> <li><a href="{:url('portal/Article/index',array('id'=>$vo.id,'cid'=>$vo.category_id))}"> <span class="gzcx_k_nr_r_img"><img src="{:cmf_get_image_url($vo.more.thumbnail)}"></span> <small>{$vo.post_title}</small></a></li> </portal:articles> </ul> </div> </div> 創建公共方法便于內頁調用 getCategoryAll() > \app\common.php /* 獲取所有的下級分類 */ function getCategoryAll($cid){ $arr = json_decode(\app\portal\service\ApiService::subCategories($cid,'id,name'),true); foreach ( $arr as $key => $val) { $nr=""; $nr.="<div class=\"panel\"><div class=\"panel-heading\" role=\"tab\" id='a$key'>"; $nr.="<h4 class=\"panel-title\">"; $nr.="<a role=\"button\" data-toggle=\"collapse\" data-parent=\"#accordion\" href='#a1$key'>".$val['name'] ; $nr.=" &nbsp; <i class=\"fa fa-angle-down\"></i> </a></h4></div>"; $bs = ($key==0) ?"in" :""; $nr.= "<div id='a1$key' class=\"panel-collapse collapse $bs \" role=\"tabpanel\" aria-labelledby='a$key'> <div class=\"panel-body\"><ul class=\"clearfix\">" ; //遍歷所有的子分類,獲取下級 $arr2 = json_decode(\app\portal\service\ApiService::subCategories($val['id'],'id,name'),true); foreach ( $arr2 as $key => $val2) { $url = url('portal/List/index',['id'=>$val2['id']]); $nr.= "<li><a href=\"$url\"><i class=\"fa fa-angle-double-right\"></i> &nbsp; $val2[name]</a></li>"; } $nr .= "</ul></div></div>" ; $nr .= "</div>" ; echo $nr; } } ### 方法說明: #### 這里的 subCategories() 是調用框架寫好的方法 返回指定分類下的子分類;在頁面轉成數組后,遍歷得出二級的分類,結合頁面樣式實現的功能。另類解決方案,個人建議用AJAX實現類似方法
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看