Bug fixes, filter by category and tags
This commit is contained in:
parent
4a7daf45a2
commit
818fdb453a
@ -24,7 +24,7 @@ class dbList extends dbJSON
|
||||
parent::__construct($file);
|
||||
}
|
||||
|
||||
private function getList($key, $amountOfItems, $pageNumber)
|
||||
public function getList($key, $pageNumber, $amountOfItems)
|
||||
{
|
||||
if( !isset($this->db[$key]) ) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error key does not exist '.$key);
|
||||
|
@ -7,7 +7,7 @@ class dbSite extends dbJSON
|
||||
'slogan'=> array('inFile'=>false, 'value'=>''),
|
||||
'description'=> array('inFile'=>false, 'value'=>''),
|
||||
'footer'=> array('inFile'=>false, 'value'=>'I wanna be a pirate!'),
|
||||
'itemsPerPage'=> array('inFile'=>false, 'value'=>''),
|
||||
'itemsPerPage'=> array('inFile'=>false, 'value'=>6),
|
||||
'language'=> array('inFile'=>false, 'value'=>'en'),
|
||||
'locale'=> array('inFile'=>false, 'value'=>'en_US'),
|
||||
'timezone'=> array('inFile'=>false, 'value'=>'America/Argentina/Buenos_Aires'),
|
||||
|
@ -115,6 +115,7 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false)
|
||||
{
|
||||
global $dbPages;
|
||||
global $dbCategories;
|
||||
global $dbTags;
|
||||
global $Site;
|
||||
global $Url;
|
||||
global $pagesByKey;
|
||||
|
@ -153,6 +153,7 @@ class Page {
|
||||
{
|
||||
global $Url;
|
||||
|
||||
$key = $this->getField('key');
|
||||
if($absolute) {
|
||||
return DOMAIN_PAGE.$key;
|
||||
}
|
||||
|
@ -30,9 +30,6 @@ class pluginCategories extends Plugin {
|
||||
global $dbCategories;
|
||||
global $Url;
|
||||
|
||||
// URL base filter for categories
|
||||
$filter = $Url->filters('category');
|
||||
|
||||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-categories">';
|
||||
$html .= '<h2 class="plugin-label">'.$this->getValue('label').'</h2>';
|
||||
|
@ -29,7 +29,6 @@ class pluginMenu extends Plugin {
|
||||
global $Language;
|
||||
global $dbCategories;
|
||||
global $Url;
|
||||
global $pagesByKey;
|
||||
|
||||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-menu">';
|
||||
@ -45,7 +44,8 @@ class pluginMenu extends Plugin {
|
||||
$html .= '<span class="category-name">'.$fields['name'].'</span>';
|
||||
$html .= '<ul class="submenu">';
|
||||
foreach( $pageList as $pageKey ) {
|
||||
$page = $pagesByKey[$pageKey];
|
||||
// Create the page object from the page key
|
||||
$page = buildPage($pageKey);
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="'.$page->permalink().'" class="page-title">';
|
||||
$html .= $page->title();
|
||||
|
@ -40,17 +40,21 @@ class pluginPages extends Plugin {
|
||||
public function siteSidebar()
|
||||
{
|
||||
global $Language;
|
||||
global $pages;
|
||||
global $Url;
|
||||
|
||||
// URL base filter for categories
|
||||
$filter = $Url->filters('page');
|
||||
global $Site;
|
||||
global $dbPages;
|
||||
|
||||
// Amount of pages to show
|
||||
$amountOfItems = $this->getValue('amountOfItems');
|
||||
|
||||
// Slice array of pages
|
||||
$pages = array_slice($pages, 0, $amountOfItems);
|
||||
// Page number the first one
|
||||
$pageNumber = 1;
|
||||
|
||||
// Only published pages
|
||||
$onlyPublished = true;
|
||||
|
||||
// Get the list of pages
|
||||
$pages = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished, true);
|
||||
|
||||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-pages">';
|
||||
@ -61,16 +65,18 @@ class pluginPages extends Plugin {
|
||||
// Show Home page link
|
||||
if( $this->getValue('homeLink') ) {
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="'.DOMAIN_BASE.'">';
|
||||
$html .= '<a href="'.$Site->url().'">';
|
||||
$html .= $Language->get('Home page');
|
||||
$html .= '</a>';
|
||||
$html .= '</li>';
|
||||
}
|
||||
|
||||
// By default the database of categories are alphanumeric sorted
|
||||
foreach( $pages as $page ) {
|
||||
// Show page list
|
||||
foreach( $pages as $pageKey=>$fields ) {
|
||||
// Create the page object from the page key
|
||||
$page = buildPage($pageKey);
|
||||
$html .= '<li>';
|
||||
$html .= '<a href="'.DOMAIN_BASE.$filter.'/'.$page->key().'">';
|
||||
$html .= '<a href="'.$page->permalink().'">';
|
||||
$html .= $page->title();
|
||||
$html .= '</a>';
|
||||
$html .= '</li>';
|
||||
|
@ -370,7 +370,7 @@ function install($adminPassword, $email, $timezone)
|
||||
'theme'=>'editorial',
|
||||
'adminTheme'=>'default',
|
||||
'homepage'=>'',
|
||||
'itemsPerPage'=>'6',
|
||||
'itemsPerPage'=>6,
|
||||
'uriPage'=>'/',
|
||||
'uriTag'=>'/tag/',
|
||||
'uriCategory'=>'/category/',
|
||||
|
Loading…
Reference in New Issue
Block a user