Predefined pages, such as homepage and page not found
This commit is contained in:
parent
6b15fcb427
commit
8e9578dcc4
|
@ -94,4 +94,6 @@ foreach($allPublishedPages as $key=>$page) {
|
||||||
} else {
|
} else {
|
||||||
$homepageOptions[$key] = $page->title();
|
$homepageOptions[$key] = $page->title();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ksort($homepageOptions);
|
||||||
}
|
}
|
|
@ -28,11 +28,11 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
|
||||||
'tip'=>$L->g('the-url-of-your-site')
|
'tip'=>$L->g('the-url-of-your-site')
|
||||||
));
|
));
|
||||||
|
|
||||||
HTML::legend(array('value'=>$L->g('Home page')));
|
HTML::legend(array('value'=>$L->g('Predefined pages')));
|
||||||
|
|
||||||
HTML::formSelect(array(
|
HTML::formSelect(array(
|
||||||
'name'=>'homepage',
|
'name'=>'homepage',
|
||||||
'label'=>$L->g('Default home page'),
|
'label'=>$L->g('Home page'),
|
||||||
'options'=>$homepageOptions,
|
'options'=>$homepageOptions,
|
||||||
'selected'=>$Site->homepage(),
|
'selected'=>$Site->homepage(),
|
||||||
'class'=>'uk-width-1-3 uk-form-medium',
|
'class'=>'uk-width-1-3 uk-form-medium',
|
||||||
|
@ -40,6 +40,16 @@ HTML::formOpen(array('class'=>'uk-form-horizontal'));
|
||||||
'addEmptySpace'=>true
|
'addEmptySpace'=>true
|
||||||
));
|
));
|
||||||
|
|
||||||
|
HTML::formSelect(array(
|
||||||
|
'name'=>'pageNotFound',
|
||||||
|
'label'=>$L->g('Page not found'),
|
||||||
|
'options'=>$homepageOptions,
|
||||||
|
'selected'=>$Site->pageNotFound(),
|
||||||
|
'class'=>'uk-width-1-3 uk-form-medium',
|
||||||
|
'tip'=>'',
|
||||||
|
'addEmptySpace'=>true
|
||||||
|
));
|
||||||
|
|
||||||
HTML::legend(array('value'=>$L->g('Website or Blog')));
|
HTML::legend(array('value'=>$L->g('Website or Blog')));
|
||||||
|
|
||||||
HTML::formSelect(array(
|
HTML::formSelect(array(
|
||||||
|
|
|
@ -134,9 +134,9 @@ elseif ($Url->whereAmI()==='admin') {
|
||||||
|
|
||||||
// Set page 404 not found
|
// Set page 404 not found
|
||||||
if ($Url->notFound()) {
|
if ($Url->notFound()) {
|
||||||
$page = $Page = buildPage('error');
|
$page = buildPage( $Site->pageNotFound() );
|
||||||
if ($page===false) {
|
if ($page===false) {
|
||||||
$page = buildErrorPage();
|
$page = buildErrorPage();
|
||||||
}
|
}
|
||||||
$pages[0] = $page;
|
$pages[0] = $Page = $page;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ class dbSite extends dbJSON
|
||||||
'theme'=> array('inFile'=>false, 'value'=>'pure'),
|
'theme'=> array('inFile'=>false, 'value'=>'pure'),
|
||||||
'adminTheme'=> array('inFile'=>false, 'value'=>'default'),
|
'adminTheme'=> array('inFile'=>false, 'value'=>'default'),
|
||||||
'homepage'=> array('inFile'=>false, 'value'=>''),
|
'homepage'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
'pageNotFound'=> array('inFile'=>false, 'value'=>''),
|
||||||
'uriPage'=> array('inFile'=>false, 'value'=>'/'),
|
'uriPage'=> array('inFile'=>false, 'value'=>'/'),
|
||||||
'uriTag'=> array('inFile'=>false, 'value'=>'/tag/'),
|
'uriTag'=> array('inFile'=>false, 'value'=>'/tag/'),
|
||||||
'uriCategory'=> array('inFile'=>false, 'value'=>'/category/'),
|
'uriCategory'=> array('inFile'=>false, 'value'=>'/category/'),
|
||||||
|
@ -290,6 +291,16 @@ class dbSite extends dbJSON
|
||||||
return $homepage;
|
return $homepage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the page defined for "Page not found", FALSE if not defined
|
||||||
|
public function pageNotFound()
|
||||||
|
{
|
||||||
|
$pageNotFound = $this->getField('pageNotFound');
|
||||||
|
if( empty($pageNotFound) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $pageNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the locale, returns TRUE is success, FALSE otherwise
|
// Set the locale, returns TRUE is success, FALSE otherwise
|
||||||
public function setLocale($locale)
|
public function setLocale($locale)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,8 +72,8 @@ function buildErrorPage() {
|
||||||
global $Language;
|
global $Language;
|
||||||
|
|
||||||
$page = new Page(false);
|
$page = new Page(false);
|
||||||
$page->setField('title', 'Page not found');
|
$page->setField('title', $Language->get('page-not-found'));
|
||||||
$page->setField('content', $Language->get('installer-page-error-content'));
|
$page->setField('content', $Language->get('page-not-found-content'));
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,5 +147,8 @@
|
||||||
"there-are-no-draft-pages": "There are no draft pages",
|
"there-are-no-draft-pages": "There are no draft pages",
|
||||||
"order-content-by": "Order content By",
|
"order-content-by": "Order content By",
|
||||||
"edit-or-delete-content-from-your-site": "Edit or delete content from your site",
|
"edit-or-delete-content-from-your-site": "Edit or delete content from your site",
|
||||||
"order-the-content-by-position-to-build-a-website": "Order the content by position to build a Website or order the content by date to build a Blog."
|
"order-the-content-by-position-to-build-a-website": "Order the content by position to build a Website or order the content by date to build a Blog.",
|
||||||
|
"page-not-found-content": "Hey! look like the page doesn't exist.",
|
||||||
|
"page-not-found": "Page not found",
|
||||||
|
"predefined-pages": "Predefined pages"
|
||||||
}
|
}
|
Loading…
Reference in New Issue