diff --git a/templates/shaper_helixultimate/features/title.php b/templates/shaper_helixultimate/features/title.php index 9b5b5d80..db39f70d 100644 --- a/templates/shaper_helixultimate/features/title.php +++ b/templates/shaper_helixultimate/features/title.php @@ -1,12 +1,10 @@ - * Copyright (c) 2010 - 2021 JoomShaper + * @version 1.0.0 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later */ - defined ('_JEXEC') or die(); use Joomla\CMS\Factory; @@ -37,6 +35,7 @@ class HelixUltimateFeatureTitle */ public function __construct($params) { + $this->params = $params; // اضافه شده برای تنظیم پارامترها $this->position = 'title'; } @@ -48,26 +47,23 @@ public function __construct($params) */ public function renderFeature() { - $app = Factory::getApplication(); - $menuitem = $app->getMenu()->getActive(); + $menuitem = $app->getMenu()->getActive(); - if($menuitem) + if ($menuitem) { - $params = $menuitem->getParams(); - if($params->get('helixultimate_enable_page_title', 0)) + if ($params->get('helixultimate_enable_page_title', 0)) { - - $page_title = $menuitem->title; - $page_heading = $params->get('helixultimate_page_title_heading', 'h2'); - $page_title_alt = $params->get('helixultimate_page_title_alt'); - $page_subtitle = $params->get('helixultimate_page_subtitle'); + $page_title = $menuitem->title; + $page_heading = $params->get('helixultimate_page_title_heading', 'h2'); + $page_title_alt = $params->get('helixultimate_page_title_alt'); + $page_subtitle = $params->get('helixultimate_page_subtitle'); $page_title_bg_color = $params->get('helixultimate_page_title_bg_color'); $page_title_bg_image = $params->get('helixultimate_page_title_bg_image'); - if($page_heading == 'h1') + if ($page_heading == 'h1') { $page_sub_heading = 'h2'; } @@ -78,36 +74,59 @@ public function renderFeature() $style = ''; - if($page_title_bg_color) + if ($page_title_bg_color) { $style .= 'background-color: ' . $page_title_bg_color . ';'; } - if($page_title_bg_image) + if ($page_title_bg_image) { $style .= 'background-image: url(' . Uri::root(true) . '/' . $page_title_bg_image . ');'; } - if($style) + if ($style) { $style = 'style="' . $style . '"'; } - if($page_title_alt) + if ($page_title_alt) { - $page_title = $page_title_alt; + $page_title = $page_title_alt; + } + + // بررسی اگر صفحه جاری یک صفحه مطلب است و تنظیم عنوان مطلب + $input = $app->input; + $option = $input->getCmd('option'); + $view = $input->getCmd('view'); + $id = $input->getInt('id'); + + if ($option == 'com_content' && $view == 'article' && $id) + { + // دریافت عنوان مطلب از جوملا + $db = Factory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('title')) + ->from($db->quoteName('#__content')) + ->where($db->quoteName('id') . ' = ' . (int) $id); + $db->setQuery($query); + $article_title = $db->loadResult(); + + if ($article_title) + { + $page_title = $article_title; + } } $output = ''; - $output .= '
'; + $output .= '
'; $output .= '
'; - $output .= '<'. $page_heading .' class="sp-page-title-heading">'. $page_title .''; + $output .= '<' . $page_heading . ' class="sp-page-title-heading">' . $page_title . ''; - if($page_subtitle) + if ($page_subtitle) { - $output .= '<'. $page_sub_heading .' class="sp-page-title-sub-heading">'. $page_subtitle .''; + $output .= '<' . $page_sub_heading . ' class="sp-page-title-sub-heading">' . $page_subtitle . ''; } $output .= ''; @@ -116,10 +135,7 @@ public function renderFeature() $output .= '
'; return $output; - } - } - } }