當前位置: 首頁>>代碼示例>>PHP>>正文


PHP misc::build_category_select_box方法代碼示例

本文整理匯總了PHP中misc::build_category_select_box方法的典型用法代碼示例。如果您正苦於以下問題:PHP misc::build_category_select_box方法的具體用法?PHP misc::build_category_select_box怎麽用?PHP misc::build_category_select_box使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在misc的用法示例。


在下文中一共展示了misc::build_category_select_box方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: trim

    $title = $_POST['title'];
    if (!$title) {
        $error .= '<li> Category cannot be left blank';
    } else {
        $title = trim($title);
        if (strlen($title) > 50) {
            $error .= '<li> Title is too long (Max. 50 Characters)';
        }
        $title = str_replace('"', '&quot;', $title);
    }
    if (!$error) {
        $base_instance->query('INSERT INTO ' . $base_instance->entity['LINK']['CATEGORY'] . ' (title,user,parent_id) VALUES ("' . sql_safe($title) . '",' . $userid . ',' . $category_id . ')');
        $cat_id = mysqli_insert_id($base_instance->db_link);
        $base_instance->show_message('Link Category saved', '<a href="add-link.php?category_id=' . $cat_id . '">[Add Link]</a> &nbsp;&nbsp; <a href="add-link-category.php">[Add Category]</a> &nbsp;&nbsp; <a href="edit-link-category.php?category_id=' . $cat_id . '">[Edit]</a> &nbsp;&nbsp; <a href="javascript:void(window.open(\'delete-link-category.php?category_id=' . $cat_id . '\',\'\',\'width=450,height=200,top=100,left=100\'))">[Delete]</a><p><a href="show-link-categories.php">[Show Link Categories]</a>');
    } else {
        $html_instance->error_message = $error;
        $title = stripslashes($title);
    }
}
$select_box = '&nbsp;<select name="category_id">';
if (empty($category_id)) {
    $select_box .= "<option selected value=0>-- MAIN CATEGORY --";
} else {
    $select_box .= '<option value=0>-- MAIN CATEGORY --';
}
$select_box .= $misc_instance->build_category_select_box(0, $userid, 0, $category_id);
$select_box .= '</select>';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'New Link Category', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.title.focus()"', 'INNER_TABLE_WIDTH' => '400', 'TD_WIDTH' => '30%', 'BUTTON_TEXT' => 'Save Category'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => '', 'SIZE' => 35, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Subcategory of', 'TEXT2' => "{$select_box}", 'SECTIONS' => 2));
$html_instance->process();
開發者ID:vijo,項目名稱:Blue-Smiley-Organizer,代碼行數:31,代碼來源:add-link-category.php


注:本文中的misc::build_category_select_box方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。