assign('toolbar', Utility::toolbar_bootstrap($interface_menu, false, $interface_icon)); $xoTheme->addStylesheet('modules/tad_idioms/css/module.css'); require_once XOOPS_ROOT_PATH . '/footer.php'; /*-----------function區--------------*/ //列出所有tad_idioms資料 function list_tad_idioms($show_sn = '') { global $xoopsDB, $xoopsTpl; $andkeyword = ''; if (isset($_POST['keyword'])) { $keyword = $xoopsDB->escape($_POST['keyword']); $andkeyword = " where `title` like '%{$keyword}%' or `mean` like '%{$keyword}%'"; } $sql = 'select * from ' . $xoopsDB->prefix('tad_idioms') . " $andkeyword"; //Utility::getPageBar($原sql語法, 每頁顯示幾筆資料, 最多顯示幾個頁數選項); $PageBar = Utility::getPageBar($sql, 20, 10); $bar = $PageBar['bar']; $sql = $PageBar['sql']; $total = $PageBar['total']; $result = $xoopsDB->query($sql) or Utility::web_error($sql, __FILE__, __LINE__); $all_content = []; $i = 0; while (false !== ($all = $xoopsDB->fetchArray($result))) { //以下會產生這些變數: $sn , $title , $juin , $mean , $show_times , $search_times , $cate foreach ($all as $k => $v) { $$k = $v; } $ji = explode(' ', $juin); $main = ''; $sound = [_MD_TADIDIOMS_2, _MD_TADIDIOMS_3, _MD_TADIDIOMS_4, _MD_TADIDIOMS_5]; foreach ($ji as $n => $juin) { $sud = substr($juin, -2); if (in_array($sud, $sound)) { $juin = substr($juin, 0, -2); $lh = strlen($juin) > 6 ? 80 : 120; } else { $sud = ' '; $lh = strlen($juin) > 6 ? 80 : 120; } $m = $n * 3; $txt = substr($title, $m, 3); $main .= "