本文整理匯總了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}");
}
}