diff --git a/bl-kernel/admin/views/settings.php b/bl-kernel/admin/views/settings.php index ba32b519..a9a02f22 100644 --- a/bl-kernel/admin/views/settings.php +++ b/bl-kernel/admin/views/settings.php @@ -306,6 +306,15 @@ echo Bootstrap::formInputHidden(array( 'tip' => DOMAIN_ARCHIVES )); + echo Bootstrap::formInputText(array( + 'name' => 'uriKind', + 'label' => $L->g('Post Kind'), + 'value' => $site->uriFilters('kind'), + 'class' => '', + 'placeholder' => '', + 'tip' => DOMAIN_KINDS + )); + echo Bootstrap::formInputText(array( 'name' => 'uriAuthor', 'label' => $L->g('Authors'), diff --git a/bl-kernel/boot/rules/69.pages.php b/bl-kernel/boot/rules/69.pages.php index 321dd401..4b316987 100644 --- a/bl-kernel/boot/rules/69.pages.php +++ b/bl-kernel/boot/rules/69.pages.php @@ -75,10 +75,14 @@ elseif ($url->whereAmI()==='category') { elseif ($url->whereAmI()==='author') { $content = buildPagesByAuthor(); } -// Build content by author +// Build content by archive elseif ($url->whereAmI()==='archive') { $content = buildPagesByArchive(); } +// Build content by archive +elseif ($url->whereAmI()==='kind') { + $content = buildPagesByKind(); +} // Build content for the homepage elseif ( ($url->whereAmI()==='home') || ($url->whereAmI()==='blog') ) { $content = buildPagesForHome(); diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index bd5f1ec2..a93e9dfd 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -126,10 +126,20 @@ function buildPagesByArchive() return buildPagesFor('archive', false, false, false, $archiveKey); } +// This function is only used from the rule 69.pages.php, DO NOT use this function! +function buildPagesByKind() +{ + global $url; + + $kindKey = $url->slug(); + return buildPagesFor('kind', false, false, false, false, $kindKey); +} + + // 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, $archiveKey = false) +function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey = false, $archiveKey = false, $kindKey = false) { global $pages; global $categories; @@ -138,6 +148,7 @@ function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey = global $url; global $authors; global $archives; + global $kinds; // Get the page number from URL $pageNumber = $url->pageNumber(); @@ -164,6 +175,9 @@ function buildPagesFor($for, $categoryKey = false, $tagKey = false, $authorKey = } elseif ($for == 'archive') { $numberOfItems = $site->itemsPerPage(); $list = $archives->getList($archiveKey, $pageNumber, $numberOfItems); + } elseif ($for == 'kind') { + $numberOfItems = $site->itemsPerPage(); + $list = $kinds->getList($kindKey, $pageNumber, $numberOfItems); } // There are not items, invalid tag, invalid category, out of range, etc... diff --git a/bl-kernel/kinds.class.php b/bl-kernel/kinds.class.php index ea5b9ef3..1a697a0f 100644 --- a/bl-kernel/kinds.class.php +++ b/bl-kernel/kinds.class.php @@ -27,7 +27,7 @@ class Kinds extends dbList { $db = $pages->getDB($onlyKeys=false); foreach ($db as $pageKey=>$pageFields) { - if ($pageFields['state'] == "published" && isset($pageFields['kinds']) && $pageFields !== '') { + if ($pageFields['type'] == "published" && isset($pageFields['kind']) && $pageFields !== '') { $kind = $pageFields['kind']; // Index by years diff --git a/bl-kernel/site.class.php b/bl-kernel/site.class.php index a62c69aa..495031ac 100644 --- a/bl-kernel/site.class.php +++ b/bl-kernel/site.class.php @@ -21,6 +21,7 @@ class Site extends dbJSON 'uriBlog' => '/blog/', 'uriAuthor' => '/author/', 'uriArchive' => '/archive/', + 'uriKind' => '/kind/', 'url' => '', 'emailFrom' => '', 'dateFormat' => 'F j, Y', @@ -104,7 +105,8 @@ 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'); + $filters['archive'] = $this->getField('uriArchive'); + $filters['kind'] = $this->getField('uriKind'); if ($this->getField('uriBlog')) { $filters['blog'] = $this->getField('uriBlog');