✨ (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
|
||||
define('AUTHOR_URI_FILTER', $url->filters('author'));
|
||||
|
||||
// Archive URI filter
|
||||
define('ARCHIVE_URI_FILTER', $url->filters('archive'));
|
||||
|
||||
// Page URI filter
|
||||
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_PAGES', Text::addSlashes(DOMAIN_BASE . PAGE_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_VIEW = '';
|
||||
|
|
|
@ -75,6 +75,10 @@ elseif ($url->whereAmI()==='category') {
|
|||
elseif ($url->whereAmI()==='author') {
|
||||
$content = buildPagesByAuthor();
|
||||
}
|
||||
// Build content by author
|
||||
elseif ($url->whereAmI()==='archive') {
|
||||
$content = buildPagesByArchive();
|
||||
}
|
||||
// Build content for the homepage
|
||||
elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) {
|
||||
$content = buildPagesForHome();
|
||||
|
|
|
@ -109,10 +109,19 @@ function buildPagesByAuthor()
|
|||
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!
|
||||
// Generate the global variables $content / $content, defined on 69.pages.php
|
||||
// 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 $categories;
|
||||
|
@ -120,6 +129,7 @@ function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey =
|
|||
global $site;
|
||||
global $url;
|
||||
global $authors;
|
||||
global $archives;
|
||||
|
||||
// Get the page number from URL
|
||||
$pageNumber = $url->pageNumber();
|
||||
|
@ -143,6 +153,9 @@ function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey =
|
|||
} elseif ($for == 'author') {
|
||||
$numberOfItems = $site->itemsPerPage();
|
||||
$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...
|
||||
|
|
|
@ -20,6 +20,7 @@ class Site extends dbJSON
|
|||
'uriCategory' => '/category/',
|
||||
'uriBlog' => '/blog/',
|
||||
'uriAuthor' => '/author/',
|
||||
'uriArchive' => '/archive/',
|
||||
'url' => '',
|
||||
'emailFrom' => '',
|
||||
'dateFormat' => 'F j, Y',
|
||||
|
@ -101,6 +102,7 @@ class Site extends dbJSON
|
|||
$filters['tag'] = $this->getField('uriTag');
|
||||
$filters['category'] = $this->getField('uriCategory');
|
||||
$filters['author'] = $this->getField('uriAuthor');
|
||||
$filters['archive'] = $this->getField(field: 'uriArchive');
|
||||
|
||||
if ($this->getField('uriBlog')) {
|
||||
$filters['blog'] = $this->getField('uriBlog');
|
||||
|
|
Loading…
Reference in a new issue