✨ (pages): show pages by dates
This commit is contained in:
parent
a5805a1f3f
commit
ac507092d8
4 changed files with 24 additions and 1 deletions
|
@ -200,6 +200,9 @@ define('CATEGORY_URI_FILTER', $url->filters('category'));
|
||||||
// Author URI filter
|
// Author URI filter
|
||||||
define('AUTHOR_URI_FILTER', $url->filters('author'));
|
define('AUTHOR_URI_FILTER', $url->filters('author'));
|
||||||
|
|
||||||
|
// Archive URI filter
|
||||||
|
define('ARCHIVE_URI_FILTER', $url->filters('archive'));
|
||||||
|
|
||||||
// Page URI filter
|
// Page URI filter
|
||||||
define('PAGE_URI_FILTER', $url->filters('page'));
|
define('PAGE_URI_FILTER', $url->filters('page'));
|
||||||
|
|
||||||
|
@ -257,6 +260,7 @@ define('DOMAIN_TAGS', Text::addSlashes(DOMAIN_BASE . TAG_URI_FILTER, false, tr
|
||||||
define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE . CATEGORY_URI_FILTER, false, true));
|
define('DOMAIN_CATEGORIES', Text::addSlashes(DOMAIN_BASE . CATEGORY_URI_FILTER, false, true));
|
||||||
define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_URI_FILTER, false, true));
|
define('DOMAIN_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_URI_FILTER, false, true));
|
||||||
define('DOMAIN_AUTHORS', Text::addSlashes(DOMAIN_BASE . AUTHOR_URI_FILTER, false, true));
|
define('DOMAIN_AUTHORS', Text::addSlashes(DOMAIN_BASE . AUTHOR_URI_FILTER, false, true));
|
||||||
|
define('DOMAIN_ARCHIVES', Text::addSlashes(DOMAIN_BASE . ARCHIVE_URI_FILTER, false, true));
|
||||||
|
|
||||||
$ADMIN_CONTROLLER = '';
|
$ADMIN_CONTROLLER = '';
|
||||||
$ADMIN_VIEW = '';
|
$ADMIN_VIEW = '';
|
||||||
|
|
|
@ -75,6 +75,10 @@ elseif ($url->whereAmI()==='category') {
|
||||||
elseif ($url->whereAmI()==='author') {
|
elseif ($url->whereAmI()==='author') {
|
||||||
$content = buildPagesByAuthor();
|
$content = buildPagesByAuthor();
|
||||||
}
|
}
|
||||||
|
// Build content by author
|
||||||
|
elseif ($url->whereAmI()==='archive') {
|
||||||
|
$content = buildPagesByArchive();
|
||||||
|
}
|
||||||
// Build content for the homepage
|
// Build content for the homepage
|
||||||
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
|
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
|
||||||
$content = buildPagesForHome();
|
$content = buildPagesForHome();
|
||||||
|
|
|
@ -109,10 +109,19 @@ function buildPagesByAuthor()
|
||||||
return buildPagesFor('author', false, false, $authorKey);
|
return buildPagesFor('author', false, false, $authorKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
||||||
|
function buildPagesByArchive()
|
||||||
|
{
|
||||||
|
global $url;
|
||||||
|
|
||||||
|
$archiveKey = $url->slug();
|
||||||
|
return buildPagesFor('archive', false, false, false, $archiveKey);
|
||||||
|
}
|
||||||
|
|
||||||
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
// This function is only used from the rule 69.pages.php, DO NOT use this function!
|
||||||
// Generate the global variables $content / $content, defined on 69.pages.php
|
// Generate the global variables $content / $content, defined on 69.pages.php
|
||||||
// This function is use for buildPagesForHome(), buildPagesByCategory(), buildPagesByTag()
|
// This function is use for buildPagesForHome(), buildPagesByCategory(), buildPagesByTag()
|
||||||
function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey = false)
|
function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey = false, $archiveKey = false)
|
||||||
{
|
{
|
||||||
global $pages;
|
global $pages;
|
||||||
global $categories;
|
global $categories;
|
||||||
|
@ -120,6 +129,7 @@ function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey =
|
||||||
global $site;
|
global $site;
|
||||||
global $url;
|
global $url;
|
||||||
global $authors;
|
global $authors;
|
||||||
|
global $archives;
|
||||||
|
|
||||||
// Get the page number from URL
|
// Get the page number from URL
|
||||||
$pageNumber = $url->pageNumber();
|
$pageNumber = $url->pageNumber();
|
||||||
|
@ -143,6 +153,9 @@ function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey =
|
||||||
} elseif ($for == 'author') {
|
} elseif ($for == 'author') {
|
||||||
$numberOfItems = $site->itemsPerPage();
|
$numberOfItems = $site->itemsPerPage();
|
||||||
$list = $authors->getList($authorKey, $pageNumber, $numberOfItems);
|
$list = $authors->getList($authorKey, $pageNumber, $numberOfItems);
|
||||||
|
} elseif ($for == 'archive') {
|
||||||
|
$numberOfItems = $site->itemsPerPage();
|
||||||
|
$list = $archives->getList($archiveKey, $pageNumber, $numberOfItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are not items, invalid tag, invalid category, out of range, etc...
|
// There are not items, invalid tag, invalid category, out of range, etc...
|
||||||
|
|
|
@ -20,6 +20,7 @@ class Site extends dbJSON
|
||||||
'uriCategory' => '/category/',
|
'uriCategory' => '/category/',
|
||||||
'uriBlog' => '/blog/',
|
'uriBlog' => '/blog/',
|
||||||
'uriAuthor' => '/author/',
|
'uriAuthor' => '/author/',
|
||||||
|
'uriArchive' => '/archive/',
|
||||||
'url' => '',
|
'url' => '',
|
||||||
'emailFrom' => '',
|
'emailFrom' => '',
|
||||||
'dateFormat' => 'F j, Y',
|
'dateFormat' => 'F j, Y',
|
||||||
|
@ -101,6 +102,7 @@ class Site extends dbJSON
|
||||||
$filters['tag'] = $this->getField('uriTag');
|
$filters['tag'] = $this->getField('uriTag');
|
||||||
$filters['category'] = $this->getField('uriCategory');
|
$filters['category'] = $this->getField('uriCategory');
|
||||||
$filters['author'] = $this->getField('uriAuthor');
|
$filters['author'] = $this->getField('uriAuthor');
|
||||||
|
$filters['archive'] = $this->getField(field: 'uriArchive');
|
||||||
|
|
||||||
if ($this->getField('uriBlog')) {
|
if ($this->getField('uriBlog')) {
|
||||||
$filters['blog'] = $this->getField('uriBlog');
|
$filters['blog'] = $this->getField('uriBlog');
|
||||||
|
|
Loading…
Add table
Reference in a new issue