線上書籍

Home

[1071]XOOPS模組開發

<?php function snews_block_focus($options) { include_once XOOPS_ROOT_PATH . "/modules/snews/function_block.php"; $json = file_get_contents(XOOPS_URL . "/uploads/snews/focus.json"); $all_focus = json_decode($json, true); $keys = array_rand($all_focus, $options[0]); if (is_array($keys)) { foreach ($keys as $k) { $all_focus[$k]['content'] = word_cut($all_focus[$k]['content'], $options[1]); $block[] = $all_focus[$k]; } } else { $all_focus[$keys]['content'] = word_cut($all_focus[$keys]['content'], $options[1]); $block[] = $all_focus[$keys]; } return $block; } function snews_block_focus_edit($options) { $form = _MB_SNEWS_BLOCK_OPT0 . " <input type='text' name='options[0]' value='{$options[0]}'> <br> " . _MB_SNEWS_BLOCK_OPT1 . "<input type='text' name='options[1]' value='{$options[1]}'> "; return $form; }