From 185ffda5ca31ab61cfd6c4ad789d38b52a2bf0dd Mon Sep 17 00:00:00 2001 From: dignajar Date: Mon, 26 Sep 2016 00:25:40 -0300 Subject: [PATCH] Tag in title of page --- bl-kernel/dbtags.class.php | 9 +++++++++ bl-kernel/helpers/theme.class.php | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/bl-kernel/dbtags.class.php b/bl-kernel/dbtags.class.php index e0b64e2a..d5f11dd7 100644 --- a/bl-kernel/dbtags.class.php +++ b/bl-kernel/dbtags.class.php @@ -18,6 +18,15 @@ class dbTags extends dbJSON parent::__construct(PATH_DATABASES.'tags.php'); } + public function getTag($slug) { + + if( isset($this->db['postsIndex'][$slug]['name']) ) { + return $this->db['postsIndex'][$slug]['name']; + } + + return ''; + } + // Returns an array with all tags names public function getAll() { diff --git a/bl-kernel/helpers/theme.class.php b/bl-kernel/helpers/theme.class.php index 082e0c9d..8b229c74 100644 --- a/bl-kernel/helpers/theme.class.php +++ b/bl-kernel/helpers/theme.class.php @@ -59,6 +59,7 @@ class Theme { global $Url; global $Post, $Page; global $Site; + global $dbTags; $tmp = $title; @@ -70,6 +71,10 @@ class Theme { elseif( $Url->whereAmI()=='page' ) { $tmp = $Page->title().' - '.$Site->title(); } + elseif( $Url->whereAmI()=='tag' ) { + $tag = $dbTags->getTag($Url->slug()); + $tmp = $tag.' - '.$Site->title(); + } else { $tmp = $Site->title(); }