Allow static pages to have subpages
This commit is contained in:
parent
7aba5362c6
commit
3dd31b9d11
|
@ -77,7 +77,7 @@ function table($type) {
|
||||||
foreach ($list as $pageKey) {
|
foreach ($list as $pageKey) {
|
||||||
try {
|
try {
|
||||||
$page = new Page($pageKey);
|
$page = new Page($pageKey);
|
||||||
if (!$page->isChild() || $type!='published') {
|
if (!$page->isChild()) {
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
|
@ -106,7 +106,7 @@ function table($type) {
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
foreach ($page->children() as $child) {
|
foreach ($page->children() as $child) {
|
||||||
if ($child->published()) {
|
//if ($child->published()) {
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
<td class="child">
|
<td class="child">
|
||||||
<div>
|
<div>
|
||||||
|
@ -133,7 +133,7 @@ function table($type) {
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
| Returns a list of pages are parent and match with the string in them titles
|
| Returns a list of parent pages and the title contains the query string
|
||||||
|
| The returned list have published, sticky and statics pages
|
||||||
|
|
|
|
||||||
| @_POST['query'] string The string to search in the title of the pages
|
| @_POST['query'] string The string to search in the title of the pages
|
||||||
|
|
|
|
||||||
|
@ -19,11 +20,23 @@ if ($query===false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
$parents = buildParentPages();
|
$pagesKey = $pages->getDB();
|
||||||
foreach ($parents as $parent) {
|
foreach ($pagesKey as $pageKey) {
|
||||||
$lowerTitle = Text::lowercase($parent->title());
|
try {
|
||||||
if (Text::stringContains($lowerTitle, $query)) {
|
$page = new Page($pageKey);
|
||||||
$tmp[$parent->title()] = $parent->key();
|
// Check if the page is available to be parent
|
||||||
|
if ($page->isParent()) {
|
||||||
|
// Check page status
|
||||||
|
if ($page->published() || $page->sticky() || $page->isStatic()) {
|
||||||
|
// Check if the query contains in the title
|
||||||
|
$lowerTitle = Text::lowercase($page->title());
|
||||||
|
if (Text::stringContains($lowerTitle, $query)) {
|
||||||
|
$tmp[$page->title()] = $page->key();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue