本文整理汇总了PHP中categories::add方法的典型用法代码示例。如果您正苦于以下问题:PHP categories::add方法的具体用法?PHP categories::add怎么用?PHP categories::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类categories
的用法示例。
在下文中一共展示了categories::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: categories
// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['add']);
$cms = new categories();
if (!isset($_GET['sub_of']) || !is_numeric($_GET['sub_of'])) {
$_GET['sub_of'] = 0;
}
if (isset($_POST['add'])) {
$status = $cms->add();
if ($status !== true) {
abr('error', $status);
} else {
refresh("?m=" . $_GET['m'] . "&c=list&sub_of=" . $_GET['sub_of'], $langArray['add_complete']);
}
} else {
$_POST['visible'] = 'true';
}
if ($_GET['sub_of'] != 0) {
$pdata = $cms->get($_GET['sub_of']);
abr('pdata', $pdata);
}
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
示例2: header
<?php
if (!isset($_SESSION['admin'])) {
header('location: Login');
die;
}
require 'classes/class_categories.php';
$categories = new categories();
// If there are a request to save the categories
if (isset($_POST['save_categories_submit'])) {
// Saving the categories
if (isset($_POST['categories'])) {
$categories->save($_POST['categories']);
}
// Adding new category, if admin fill one
$checked = isset($_POST['checked']) ? 1 : 0;
if (isset($_POST['name']) && isset($_POST['order']) && !empty($_POST['name']) && !empty($_POST['order'])) {
$categories->add($_POST['name'], $_POST['order'], $checked);
}
}
// If there are a request to delete category
if (isset($_GET['d'])) {
$categories->delete($_GET['d']);
}
// Gets all the categories in array
$categories->get();
require 'design/design_categories.php';