Fix duplicate title tags of Com_tags - Joomla! Forum - community, help and support
dear all,
before writing article, tired of duplicate title tags of com_tags of joomla 3.3! luckily, i've found way fix !
and it:
you can download com_tags here:
thanks viktor vogel <admin@kubik-rubik.de> !
before writing article, tired of duplicate title tags of com_tags of joomla 3.3! luckily, i've found way fix !
and it:
code: select all
https://github.com/joomla/joomla-cms/pull/3738.patch you can download com_tags here:
code: select all
http://www.mediafire.com/download/lbh5v30zkvlrahv/com_tags.rarpass: phantrungdung.com
download -> extract -> copy folder "com_tags"
code: select all
from: viktor vogel <admin@kubik-rubik.de>
date: sat, 7 jun 2014 23:24:08 +0200
subject: [patch 1/3] fix com_tags - show tags title - option
"show tag name" + page title (plus code optimizations)
---
components/com_tags/views/tag/tmpl/default.php | 2 +-
components/com_tags/views/tag/tmpl/list.php | 2 +-
components/com_tags/views/tag/view.html.php | 67 ++++++++++++++++++--------
3 files changed, 49 insertions(+), 22 deletions(-)
diff --git a/components/com_tags/views/tag/tmpl/default.php b/components/com_tags/views/tag/tmpl/default.php
index 3a9d11a..ad16916 100644
--- a/components/com_tags/views/tag/tmpl/default.php
+++ b/components/com_tags/views/tag/tmpl/default.php
@@ -21,7 +21,7 @@
<?php endif; ?>
<?php if ($this->params->get('show_tag_title', 1)) : ?>
<h2>
- <?php echo jhtml::_('content.prepare', $this->document->title, '', 'com_tag.tag'); ?>
+ <?php echo jhtml::_('content.prepare', $this->tags_title, '', 'com_tag.tag'); ?>
</h2>
<?php endif; ?>
<?php // show tag description if there single tag. ?>
diff --git a/components/com_tags/views/tag/tmpl/list.php b/components/com_tags/views/tag/tmpl/list.php
index 1234162..09e969a 100644
--- a/components/com_tags/views/tag/tmpl/list.php
+++ b/components/com_tags/views/tag/tmpl/list.php
@@ -22,7 +22,7 @@
<?php endif; ?>
<?php if ($this->params->get('show_tag_title', 1)) : ?>
<h2>
- <?php echo jhtml::_('content.prepare', $this->document->title, '', 'com_tag.tag'); ?>
+ <?php echo jhtml::_('content.prepare', $this->tags_title, '', 'com_tag.tag'); ?>
</h2>
<?php endif; ?>
<?php // show tag description if there single tag. ?>
diff --git a/components/com_tags/views/tag/view.html.php b/components/com_tags/views/tag/view.html.php
index 53fd8a1..f4511a8 100644
--- a/components/com_tags/views/tag/view.html.php
+++ b/components/com_tags/views/tag/view.html.php
@@ -30,6 +30,8 @@ class tagsviewtag extends jviewlegacy
protected $params;
+ protected $tags_title;
+
/**
* execute , display template script.
*
@@ -111,13 +113,13 @@ public function display($tpl = null)
}
}
- $this->state = &$state;
- $this->items = &$items;
- $this->children = &$children;
- $this->parent = &$parent;
- $this->pagination = &$pagination;
- $this->user = &$user;
- $this->item = &$item;
+ $this->state = $state;
+ $this->items = $items;
+ $this->children = $children;
+ $this->parent = $parent;
+ $this->pagination = $pagination;
+ $this->user = $user;
+ $this->item = $item;
// escape strings html output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
@@ -189,6 +191,9 @@ protected function _preparedocument()
$menus = $app->getmenu();
$title = null;
+ // generate tags title use page title, page heading , show tags title option
+ $this->gettagstitle();
+
// because application sets default page title,
// need menu item itself
$menu = $menus->getactive();
@@ -196,30 +201,30 @@ protected function _preparedocument()
if ($menu)
{
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
+ $title = $this->params->get('page_title', $menu->title);
+
+ if ($menu->query['option'] != 'com_tags')
+ {
+ $this->params->set('page_subheading', $menu->title);
+ }
}
else
{
- $this->params->def('page_heading', jtext::_('com_tags_default_page_title'));
+ $this->params->def('page_heading', $this->tags_title);
+ $title = $this->tags_title;
}
- if ($menu && ($menu->query['option'] != 'com_tags'))
- {
- $this->params->set('page_subheading', $menu->title);
- }
-
- $title = $this->state->params->get('page_title');
-
if (empty($title))
{
- $title = $app->getcfg('sitename');
+ $title = $app->get('sitename');
}
- elseif ($app->getcfg('sitename_pagetitles', 0) == 1)
+ elseif ($app->get('sitename_pagetitles', 0) == 1)
{
- $title = jtext::sprintf('jpagetitle', $app->getcfg('sitename'), $title);
+ $title = jtext::sprintf('jpagetitle', $app->get('sitename'), $title);
}
- elseif ($app->getcfg('sitename_pagetitles', 0) == 2)
+ elseif ($app->get('sitename_pagetitles', 0) == 2)
{
- $title = jtext::sprintf('jpagetitle', $title, $app->getcfg('sitename'));
+ $title = jtext::sprintf('jpagetitle', $title, $app->get('sitename'));
}
$this->document->settitle($title);
@@ -268,4 +273,26 @@ protected function _preparedocument()
$this->document->addheadlink(jroute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
}
}
+
+ /**
+ * creates tags title output
+ *
+ * @return bool
+ */
+ protected function gettagstitle()
+ {
+ $tags_title = array();
+
+ if (!empty($this->item))
+ {
+ foreach ($this->item $item)
+ {
+ $tags_title[] = $item->title;
+ }
+ }
+
+ $this->tags_title = implode(' ', $tags_title);
+
+ return;
+ }
}
--
1.9.3
from f06f1a176ca773a99f28bf2ab9974041b96536e6 mon sep 17 00:00:00 2001
from: viktor vogel <admin@kubik-rubik.de>
date: sat, 7 jun 2014 23:50:31 +0200
subject: [patch 2/3] added access check in title creation function
---
components/com_tags/views/tag/view.html.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/components/com_tags/views/tag/view.html.php b/components/com_tags/views/tag/view.html.php
index f4511a8..a4a660e 100644
--- a/components/com_tags/views/tag/view.html.php
+++ b/components/com_tags/views/tag/view.html.php
@@ -285,9 +285,15 @@ protected function gettagstitle()
if (!empty($this->item))
{
+ $user = jfactory::getuser();
+ $groups = $user->getauthorisedviewlevels();
+
foreach ($this->item $item)
{
- $tags_title[] = $item->title;
+ if (in_array($item->access, $groups))
+ {
+ $tags_title[] = $item->title;
+ }
}
}
--
1.9.3
from ba7a6cb39d2f4aeb23c606b9d338e9bed59fa961 mon sep 17 00:00:00 2001
from: viktor vogel <admin@kubik-rubik.de>
date: sun, 8 jun 2014 09:44:40 +0200
subject: [patch 3/3] function returns tags_title instead of setting it
directly view property , returning null
---
components/com_tags/views/tag/view.html.php | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/components/com_tags/views/tag/view.html.php b/components/com_tags/views/tag/view.html.php
index a4a660e..9f46c9a 100644
--- a/components/com_tags/views/tag/view.html.php
+++ b/components/com_tags/views/tag/view.html.php
@@ -192,7 +192,7 @@ protected function _preparedocument()
$title = null;
// generate tags title use page title, page heading , show tags title option
- $this->gettagstitle();
+ $this->tags_title = $this->gettagstitle();
// because application sets default page title,
// need menu item itself
@@ -297,8 +297,6 @@ protected function gettagstitle()
}
}
- $this->tags_title = implode(' ', $tags_title);
-
- return;
+ return implode(' ', $tags_title);
}
}
-- thanks viktor vogel <admin@kubik-rubik.de> !
Comments
Post a Comment