本文整理汇总了PHP中find_pages_for_subject函数的典型用法代码示例。如果您正苦于以下问题:PHP find_pages_for_subject函数的具体用法?PHP find_pages_for_subject怎么用?PHP find_pages_for_subject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_pages_for_subject函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: navigation
function navigation($subject_array, $page_array)
{
$output = '<ul class="subjects">';
$subject_set = find_all_subjects();
while ($subject = mysqli_fetch_assoc($subject_set)) {
$output .= "<li ";
if ($subject_array && $subject_array['id'] == $subject['id']) {
$output .= "class='selected' ";
}
$output .= "> ";
$output .= "<a href='manage_content.php?subject=" . urlencode($subject['id']) . "'> " . htmlentities($subject['menu_name']) . "</a>";
$pages_set = find_pages_for_subject($subject['id']);
$output .= "<ul class='pages'>";
while ($page = mysqli_fetch_assoc($pages_set)) {
$output .= "<li ";
if ($page_array && $page_array['id'] == $page['id']) {
$output .= "class='selected'";
}
$output .= "> ";
$output .= "<a href='manage_content.php?page=" . urlencode($page['id']) . "'> " . htmlentities($page['menu_name']) . " </a></li> ";
}
$output .= "</ul>\n </li>";
}
mysqli_free_result($subject_set);
mysqli_free_result($pages_set);
$output .= '</ul>';
return $output;
}
示例2: navigation
function navigation($subject_id, $page_id)
{
$output = "<ul class = \"subjects\">";
$subject_set = find_all_subjects();
while ($subjects = mysqli_fetch_assoc($subject_set)) {
$output .= "<li";
if ($subjects["id"] == $subject_id) {
$output .= " class=\"selected\"";
}
$output .= ">";
$output .= "<a href=\"manage_content.php?subject=";
$output .= urlencode($subjects["id"]);
$output .= "\">";
$output .= $subjects['menu_name'];
$output .= "</a>";
$page_set = find_pages_for_subject($subjects["id"]);
$output .= "<ul class = \"pages\">";
while ($pages = mysqli_fetch_assoc($page_set)) {
$output .= "<li";
if ($pages["id"] == $page_id) {
$output .= " class=\"selected\"";
}
$output .= ">";
$output .= "<a href = \"manage_content.php?page=";
$output .= urlencode($pages["id"]);
$output .= "\">";
$output .= $pages['menu_name'];
$output .= "</a> </li>";
}
mysqli_free_result($page_set);
$output .= "</ul></li>";
}
mysqli_free_result($subject_set);
$output .= "</ul>";
return $output;
}
示例3: urlencode
Visible: <?php
echo $current_subject["visible"] == 1 ? 'Yes' : 'No';
?>
<br />
<br />
<a href="edit_subject.php?subject=<?php
echo urlencode($current_subject["id"]);
?>
">Edit Subject</a>
<br />
<br />
<div class="page-info">
<h3>Pages in this subject</h3>
<ul>
<?php
$subject_pages = find_pages_for_subject($current_subject["id"], false);
while ($page = mysqli_fetch_assoc($subject_pages)) {
echo "<li>";
$safe_page_id = urlencode($page["id"]);
echo "<a href=\"manage_content.php?page={$safe_page_id}\">";
echo htmlentities($page["menu_name"]);
echo "</a>";
echo "</li>";
}
?>
</ul>
<br />
+ <a href="new_page.php?subject=<?php
echo urlencode($current_subject["id"]);
?>
">Add a new page to this subject</a>
示例4: urlencode
</h2>
<form action="edit_page.php?page=<?php
echo urlencode($current_page["id"]);
?>
" method="post" accept-charset="utf-8">
<p>Menu Name:<input type="text" name="menu_name" value="<?php
echo htmlentities($current_page["menu_name"]);
?>
"></p>
<p>Position:
<select name="position">
<?php
// so I find all the data from the database with my function
// then get the number of rows to have a max value for the for loop
// the for loop is going to make a bunch of option tags for the selection tag
$page_set = find_pages_for_subject($current_page["subject_id"]);
$page_count = mysqli_num_rows($page_set);
for ($count = 1; $count <= $page_count; $count++) {
echo "<option value=\"{$count}\"";
if ($current_page["position"] == $count) {
echo " selected";
}
echo ">{$count}</option>";
}
?>
</select>
</p>
<p>Visible:
<input type="radio" name="visible" value="0" <?php
if ($current_page["visible"] == 0) {
echo "checked";
示例5: public_content_navigation
function public_content_navigation($subject_array, $page_array)
{
$output = "<ul class=\"subjects\">";
$subject_set = find_all_subjects();
while ($subject = mysqli_fetch_assoc($subject_set)) {
$output .= "<li";
if ($subject_array && $subject["id"] == $subject_array["id"]) {
$output .= " class=\"selected\"";
}
$output .= ">";
$output .= "<a href=\"index.php?subject=";
$output .= urlencode($subject["id"]);
$output .= "\">";
$output .= htmlentities($subject["menu_name"]);
$output .= "</a>";
if ($subject_array["id"] == $subject["id"] || $page_array["subject_id"] == $subject["id"]) {
$page_set = find_pages_for_subject($subject["id"]);
$output .= "<ul class=\"pages\">";
while ($page = mysqli_fetch_assoc($page_set)) {
$output .= "<li";
if ($page_array && $page["id"] == $page_array["id"]) {
$output .= " class=\"selected\"";
}
$output .= ">";
$output .= "<a href=\"index.php?page=";
$output .= urlencode($page["id"]);
$output .= "\">";
$output .= htmlentities($page["menu_name"]);
$output .= "</a></li>";
}
$output .= "</ul>";
mysqli_free_result($page_set);
}
$output .= "</li>";
// end of the subject li
}
mysqli_free_result($subject_set);
$output .= "</ul>";
return $output;
}
示例6: public_navigation
function public_navigation($subject_array, $page_array)
{
$output = "<ul class=\"subjects\">";
$subject_set = find_all_subjects();
// 3. Use returned data (if any)
while ($subject = mysqli_fetch_assoc($subject_set)) {
// output data from each row
$output .= "<li";
if ($subject_array && $subject["id"] == $subject_array["id"]) {
$output .= " class=\"selected\"";
}
$output .= ">";
$output .= "<a href=\"index.php?subject=";
$output .= urlencode($subject["id"]);
$output .= "\">";
$output .= htmlentities($subject["menu_name"]);
$output .= "</a>";
$page_set = find_pages_for_subject($subject["id"]);
$output .= "<ul class=\"pages\">";
// 3. Use returned data (if any)
while ($page = mysqli_fetch_assoc($page_set)) {
// output data from each row
$output .= "<li";
if ($page_array && $page["id"] == $page_array["id"]) {
$output .= " class=\"selected\"";
}
$output .= ">";
$output .= "<a href=\"index.php?page=";
$output .= urlencode($page["id"]);
$output .= "\">";
$output .= htmlentities($page["menu_name"]);
$output .= "</a>";
$output .= "</li>";
}
mysqli_free_result($page_set);
$output .= "</ul>";
$output .= "</li>";
}
// 4. Release returned data
mysqli_free_result($subject_set);
$output .= "</ul>";
return $output;
}
示例7: confirm_logged_in
<?php
require_once "../includes/session.php";
require_once "../includes/db_connection.php";
require_once "../includes/functions.php";
confirm_logged_in();
?>
<?php
$current_subject = find_subject_by_id($_GET["subject"], false);
if (!$current_subject) {
// subject ID was missing or invalid or
// subject couldn't be found in database
redirect_to("manage_contenct.php");
}
$pages_set = find_pages_for_subject($current_subject["id"]);
if (mysqli_num_rows($pages_set) > 0) {
$_SESSION["message"] = "Can't delete a subject with pages.";
redirect_to("manage_content.php?subject={$current_subject["id"]}");
}
$id = $current_subject["id"];
$query = "DELETE FROM subjects WHERE id = {$id} LIMIT 1";
$result = mysqli_query($connection, $query);
if ($result && mysqli_affected_rows($connection) == 1) {
// Success
$_SESSION["message"] = "Subject deleted.";
redirect_to("manage_content.php");
} else {
// Failure
$_SESSION["message"] = "Subject deletion failed.";
redirect_to("manage_content.php?subject={$id}");
示例8: find_pages_for_subject
if ($subject["id"] == $selected_subject_id) {
echo " class=\"selected\"";
}
echo ">";
?>
<a href="manage_content.php?subject=<?php
echo $subject["id"];
?>
">
<?php
echo $subject["menu_name"];
?>
</a><ul class="pages">
<?php
$pages = find_pages_for_subject($subject["id"]);
while ($page = mysqli_fetch_assoc($pages)) {
?>
<?php
echo "<li";
if ($page["id"] == $selected_page_id) {
echo " class=\"selected\"";
}
echo ">";
?>
<a href="manage_content.php?page=<?php
echo $page["id"];
?>
">
<?php
示例9: form_errors
<?php
echo form_errors($errors);
?>
<h2>Create Page</h2>
<form action="new_page.php?subject=<?php
echo urlencode($current_subject["id"]);
?>
" method="post">
<p>Menu name:
<input type="text" name="menu_name" value="" />
</p>
<p>Position:
<select name="position">
<?php
$page_set = find_pages_for_subject($current_subject["id"], false);
$page_count = mysqli_num_rows($page_set);
for ($count = 1; $count <= $page_count + 1; $count++) {
echo "<option value=\"{$count}\">{$count}</option>";
}
?>
</select>
</p>
<p>Visible:
<input type="radio" name="visible" value="0" /> No
<input type="radio" name="visible" value="1" /> Yes
</p>
<p>Content:<br />
<textarea name="content" rows="20" cols="80"></textarea>
</p>
示例10: find_default_page_for_subject
function find_default_page_for_subject($subject_id)
{
$page_set = find_pages_for_subject($subject_id);
if ($first_page = mysqli_fetch_assoc($page_set)) {
return $first_page;
}
return null;
}
示例11: navigation
function navigation($subject_array, $page_array)
{
//current_subject/page = array or null
$output = "<ul class=\"subjects\">";
$subject_set = find_all_subjects(false);
while ($subject = mysqli_fetch_assoc($subject_set)) {
$output .= "<li";
if ($subject_array && $subject["id"] == $subject_array["id"]) {
$output .= " class=\"selected\"";
}
$output .= ">";
$output .= "<a href=\"manage_content.php?subject=";
$output .= urlencode($subject["id"]);
$output .= "\">";
$output .= htmlentities($subject["menu_name"]);
$output .= "</a>";
$page_set = find_pages_for_subject($subject["id"], false);
$output .= "<ul class=\"pages\">";
while ($page = mysqli_fetch_assoc($page_set)) {
$output .= "<li";
if ($page_array && $page["id"] == $page_array["id"]) {
$output .= " class=\"selected\"";
}
$output .= ">";
$output .= "<a href=\"manage_content.php?page=";
$output .= urlencode($page["id"]);
$output .= "\">";
$output .= htmlentities($page["menu_name"]);
$output .= "</a>";
$output .= "</li>";
}
$output .= "</ul>";
mysqli_free_result($page_set);
$output .= "</li>";
}
mysqli_free_result($subject_set);
$output .= "</ul>";
return $output;
}