首頁  >  文章  >  後端開發  >  PHPCMS v9 如何在手機端欄位綁定模板

PHPCMS v9 如何在手機端欄位綁定模板

little bottle
little bottle轉載
2019-04-22 09:20:343265瀏覽

前段時間聽朋友說phpcms的手機端,模組是有了,但是有些地方用的還不是很舒服,其中移動端欄目無法綁定模板就不是很方便。如圖,所有的欄位綁定的模板都是固定的。本篇文章主要講述了PHPCMS v9 如何在手機端欄位綁定模板,有需要的朋友可以看一下。


這次咱們就來處理下,行動端如何設定對應的模板。
這裡說是設定模板其實有點偽命題,因為設定模板需要開發不少東西,就像phpcms的欄位那樣,自己選擇模板來綁定,我們這裡為了快速、方便有更簡單的方法。
我們讓行動端的欄位和pc端的欄位綁定一樣的模板,這裡說綁定一樣的模板指的是綁定同樣的模板名字。
phpcms pc端模板路徑 phpcms\templates\default\content   預設的檔案有這些:

如果你pc端的欄位綁定範本規則如下:
圖片category_picyure.html
#美女圖片               list_picture.html㠀   list_picture.html ----->內容頁模板  show_picture.html

那麼移動端的綁定結果如下  \phpcms\templates\default\wap
圖片category_picyure.html
美女圖片     ---->內容頁模板  show_picture.html
帥哥圖片               list_picture.html      #---->21/show _picture.html#你需要模板文件,行動端欄位就能自動綁定。
下面是具體的程式碼修改
1、因為行動端首頁範本綁定的是wap\index.html,所以不做修改。
2、打開\phpcms\modules\wap\index.php
  在方法lists 中,約47行$template = ($TYPE[$typeid]['parentid']==0 && in_array($typeid ,array_unique($parentids))) ? $WAP_SETTING['category_template'] : $WAP_SETTING['list_template']; 將其註解
#  然後新增程式碼
       /
  然後新增程式碼
       /*$ 'parentid']==0 && in_array($typeid,array_unique($parentids))) ? $WAP_SETTING['category_template'] : $WAP_SETTING['list_template']其跟著pc模板規則走
        $setting = string2array($setting);
        $template = $setting['category_template'] ?plate +'categoegory_template'] $setting['list_template'] ? $setting['list_template'] : 'list';
        $template = $child ? $template : $template_list;
    重新組裝資料讓catgory的範本也能使用
        if($child){
            $catids_str = $arr             $catids_str = substr($catids_str, $pos);
            $sql = "status=99 AND catid IN ($catids_str)";
   *', $offset.','.$pagesize,'inputtime DESC');
            $total = $this->db->count($sql);# list = $this->db->select(array('status'=>'99','catid'=>$catid), '*', $offset.','.$pagesize,' inputtime DESC');
        }
        //重新組裝資料結束
        因此category 與list 相同對應的欄位範本。其中數據就是 $list。你可以使用$list進行遍歷。

3、打開\phpcms\modules\wap\index.php
  在方法show中約206行$template = $WAP_SETTING['show_template'] ? $WAP_SETTING['show_template'] : 'show '; 將其註解
       //$template = $WAP_SETTING['show_template'] ? $WAP_SETTING['show_template'] : 'show';
      //處理範本 $ 'setting']['show_template'] ? $CAT['setting']['show_template'] : 'show';
ok 這樣phpcms的行動端就處理完成了!


相關教學:
PHP影片教學

#

以上是PHPCMS v9 如何在手機端欄位綁定模板的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:cnblogs.com。如有侵權,請聯絡admin@php.cn刪除