本文整理汇总了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);
}
}
}
}