Keyword

Wrong breadcrumb on tag-sites

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
6 months 4 weeks ago #170641 by burnyourears
burnyourears replied the topic: Wrong breadcrumb on tag-sites
Ok, I did the simplest thing possible – I took the tag.php to edit the title tag and the h1. All I need is some help to fetch the related tag on the site. Here's the code for the title tag:
<?php
$safe 		= array("'");
$nonsafe 	= array("&#039;");
$safemeta 	= str_replace( $nonsafe, $safe, $this->item->title);
$newtitle   = ($safemeta . 'Artikel&uuml;bersicht');
$document   = JFactory::getDocument();
$document->setTitle($newtitle);
?>

Which code do I need to readout the related tag?

It should look like this:

$newtitle = ($safemeta . 'Artikelübersicht zu TAG');

And I want to modify the headline also:

<h1>Artikelübersicht zu TAG</h1>

Thanks for help :-)

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
6 months 4 weeks ago #170644 by Fotis
Fotis replied the topic: Wrong breadcrumb on tag-sites
First, see how K2 MVC overrides are done: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

The file you want to edit is "tag.php".

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
6 months 4 weeks ago #170646 by burnyourears
burnyourears replied the topic: Wrong breadcrumb on tag-sites
Yes I know - and I already did that the way it is described :-)

I just want to know how to get the "tag" into the site, for example into the h1. Something like

<?php if($this->params->get('show_tag')): ?>


???

Please Log in or Create an account to join the conversation.

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
6 months 3 weeks ago - 6 months 3 weeks ago #170663 by burnyourears
burnyourears replied the topic: Wrong breadcrumb on tag-sites
Ok, I try to explain it in other words – I'm struggling with the TAG page (the page that shows all the posts with the selected tag):

I want to display the name of the active tag (on this site -> tag.php) but couldn't do that, i was trying to fetch it with:
<?php echo $this->escape($this->params->get('page_title')); ?>

This didn't work, it just shows the name of the site ... and not the name of the tag.

How can I display the active tag as part of my h1?
Last edit: 6 months 3 weeks ago by burnyourears.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
6 months 3 weeks ago #170685 by Fotis
Fotis replied the topic: Wrong breadcrumb on tag-sites
Try this:
<?php echo $this->params->get('page_title_clean'); ?>

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
6 months 3 weeks ago #170686 by Fotis
Fotis replied the topic: Wrong breadcrumb on tag-sites
Worse case scenario:
<?php echo JRequest::getString('tag'); ?>

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
6 months 3 weeks ago #170693 by burnyourears
burnyourears replied the topic: Wrong breadcrumb on tag-sites
Thank you so much – that did the job for me! :-)

Can I place it as the title-tag, too? Can you tell me what to do here with it?
$newtitle   = ($safemeta . 'Artikel&uuml;bersicht');

(The complete code I use to set the title tag:)
<?php
$safe 		= array("'");
$nonsafe 	= array("&#039;");
$safemeta 	= str_replace( $nonsafe, $safe, $this->item->title);
$newtitle   = ($safemeta . 'Artikel&uuml;bersicht');
$document   = JFactory::getDocument();
$document->setTitle($newtitle);
?>

Please Log in or Create an account to join the conversation.

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
6 months 3 weeks ago #170695 by burnyourears
burnyourears replied the topic: Wrong breadcrumb on tag-sites
Ok, I figured it out by myself – here's the code to set the title tag of the tag.php:
<?php
$safe 		= array("'");
$nonsafe 	= array("&#039;");
$safemeta 	= str_replace( $nonsafe, $safe, $this->item->title);
$newtitle   = ($this->params->get('page_title_clean') .  ' | My Site Name');
$document   = JFactory::getDocument();
$document->setTitle($newtitle);
?>

Please correct me if I am wrong, but it works on my site.
Thank you for your kind help!

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
6 months 1 week ago #170766 by Fotis
Fotis replied the topic: Wrong breadcrumb on tag-sites
"$this->params->get('page_title_clean')" will return a filtered title either way, so you probably don't need the first 3 lines of code (unless you use it elsewhere in the code and you didn't include it in your snippet).

Other than that, it looks fine.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
6 months 1 week ago #170784 by burnyourears
burnyourears replied the topic: Wrong breadcrumb on tag-sites
Perfect – thank you very much!

Please Log in or Create an account to join the conversation.

Moderators: william white

Powered by Kunena Forum