XOOPS模組開發記錄
一、點選出現選單
- 樣板
	
 
      $("#edu").autocomplete({
          minLength: 0,
          source: "<{xoAppUrl uploads/ugm_bmcc/kind_edu.json}>",
      }).focus(function() {
          $(this).autocomplete("search", $(this).val());
      });
	
 - 在類別增加一項,並在儲存時,寫入 一個樣板
 
二、在有新增項目地方使用 自動完成
- 樣板
	
      $("#tbin").on("focus",".unit",function(e) {
        if (!$(this).data("autocomplete") ) {   // If the autocomplete wasn't called yet:
          $(this).autocomplete({
            minLength: 0,
            source: "<{xoAppUrl}>uploads/ugm_cart/kindUnit/kindUnit.json",
          }).focus(function() {
            $(this).autocomplete("search", $(this).val());
          });
        }
      });
	
 - 在類別管理,建立「kindUnit.json」
	
  if($kind == "kindUnit"){
    # ----得到陣列 ----------------------------
    $rows = $ugmKind->get_listArr($ofsn,$level,$enable);
    $content =[];
    foreach($rows as $row){
      $content[] = $row['title'];
    }
    #---- 檢查資料夾
    mk_dir(XOOPS_ROOT_PATH . "/uploads/{$module_name}/{$kind}");
    $file = XOOPS_ROOT_PATH . "/uploads/{$module_name}/{$kind}/{$kind}.json";
    $f = fopen($file, 'w'); //以寫入方式開啟文件
    fwrite($f, json_encode($content, JSON_UNESCAPED_UNICODE)); //將新的資料寫入到原始的文件中
    fclose($f);
  }