本文整理汇总了PHP中page::find_pages_for_subject方法的典型用法代码示例。如果您正苦于以下问题:PHP page::find_pages_for_subject方法的具体用法?PHP page::find_pages_for_subject怎么用?PHP page::find_pages_for_subject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类page
的用法示例。
在下文中一共展示了page::find_pages_for_subject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
?>
<?php
// 3. Use returned data (if any)
while ($subject = $dbo->fetch_assoc($subject_set)) {
?>
<a href="index.php?subject=<?php
echo urlencode($subject["id"]);
?>
"><?php
echo htmlentities($subject["menu_name"]);
?>
</a>
<?php
$page_set = page::find_pages_for_subject($subject["id"]);
?>
<ul class="sidemenu">
<?php
while ($page = $dbo->fetch_assoc($page_set)) {
?>
<?php
echo "<li";
if ($current_page && $current_page["id"] == $page["id"]) {
echo " class=\"selected\"";
}
echo ">";
?>
示例2: urlencode
ID: <?php
echo $current_subject["id"];
?>
<br />
<br />
<a href="edit_subject.php?subject=<?php
echo urlencode($current_subject["id"]);
?>
">Edit Subject</a>
<br />
</p>
<h2>Pages in this subject:</h2>
<?php
$page_set = page::find_pages_for_subject($current_subject["id"], false);
?>
<?php
echo page::print_page_tables($page_set);
?>
<p><a href="create_page.php?subject=<?php
echo urlencode($current_subject["id"]);
?>
">+Add a new page to this subject</a>
</p>
<?php
} elseif ($current_page) {
?>
<p><h2>Manage Page</h2></p>
示例3: delete_subject
/**
* delete a subject according user submit
* @param string $subject_id get from user click delete link
*/
public static function delete_subject($subject_id)
{
global $dbo;
$page_set = page::find_pages_for_subject($subject_id, false);
if ($dbo->count_number_rows($page_set) > 0) {
// can't delete subject with pages
$_SESSION["message"] = "can't delete subject with pages.";
utility::redirect_to("manage_content.php?shubject={$current_subject["id"]}");
// redirect have exit() affect, will not excuate below code
}
$id = $subject_id;
$query = "DELETE FROM subjects WHERE id = {$id} LIMIT 1";
$result = $dbo->query($query);
if (isset($result) && $dbo->affected_rows($result) == 1) {
// Success
$_SESSION["message"] = "Subject deletion succeed.";
utility::redirect_to("manage_content.php");
} else {
// Failure
$_SESSION["message"] = "Subject deletion failed.";
utility::redirect_to("manage_content.php?shubject={$id}");
}
}