本文整理匯總了PHP中Sections::isSection方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sections::isSection方法的具體用法?PHP Sections::isSection怎麽用?PHP Sections::isSection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sections
的用法示例。
在下文中一共展示了Sections::isSection方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isset
<?php
require "section.php";
$section = isset($_GET['section']) ? $_GET['section'] : 1;
//если секция не указано, то по умолчанию главная, т.е. 1.
$section = Sections::isSection($section) ? $section : 0;
admin($section);
function info($section)
{
$data = Sections::getIdSection($section);
return $data;
}
function tree($data, $parent_id)
{
//объеденить с деревом admin.php
if (is_array($data) and isset($data[$parent_id])) {
$tree = '<ul>';
foreach ($data[$parent_id] as $d) {
$tree .= '<li><a href="/?section=' . $d['id'] . '">' . $d['name'] . ' #' . $d['id'];
$tree .= tree($data, $d['id']);
$tree .= '</a></li>';
}
$tree .= '</ul>';
} else {
return null;
}
return $tree;
}
function menu($section)
{
$data = Sections::getIdSectionMenu($section);
示例2: act
function act($section)
{
$data = array();
$data['parent_id'] = $_POST['parent_id'];
$data['name'] = $_POST['name'];
$data['text'] = $_POST['text'];
if (isset($_POST['edit'])) {
$data['id'] = $section;
if (!Sections::isSection($data['parent_id'])) {
$data['parent_id'] = 0;
}
Sections::updateSection($data);
header("Location: " . PATH . "/admin.php?section=" . $section);
} else {
if (isset($_POST['delete'])) {
Sections::deleteSection($section);
header("Location: " . PATH . "/admin.php");
} else {
if (isset($_POST['add'])) {
if (!Sections::isSection($data['parent_id'])) {
$data['parent_id'] = 0;
}
Sections::insertSection($data);
header("Location: " . PATH . "/admin.php?section=" . $data['parent_id']);
} else {
header("Location: " . PATH . "/admin.php?section=" . $section);
}
}
}
}