Keyword

Wrong breadcrumb on tag-sites

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 11 months ago #170641 by burnyourears
Replied by burnyourears on 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&uuml;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.

More
5 years 11 months ago #170644 by JoomlaWorks
Replied by JoomlaWorks on 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".

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 11 months ago #170646 by burnyourears
Replied by burnyourears on 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
5 years 11 months ago - 5 years 11 months ago #170663 by burnyourears
Replied by burnyourears on 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: 5 years 11 months ago by burnyourears.

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

More
5 years 11 months ago #170685 by JoomlaWorks
Replied by JoomlaWorks on topic Wrong breadcrumb on tag-sites
Try this:
<?php echo $this->params->get('page_title_clean'); ?>

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
5 years 11 months ago #170686 by JoomlaWorks
Replied by JoomlaWorks on topic Wrong breadcrumb on tag-sites
Worse case scenario:
<?php echo JRequest::getString('tag'); ?>

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 11 months ago #170693 by burnyourears
Replied by burnyourears on 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
5 years 11 months ago #170695 by burnyourears
Replied by burnyourears on 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.

More
5 years 10 months ago #170766 by JoomlaWorks
Replied by JoomlaWorks on 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.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • burnyourears
  • burnyourears's Avatar Topic Author
  • Offline
  • Senior Member
More
5 years 10 months ago #170784 by burnyourears
Replied by burnyourears on topic Wrong breadcrumb on tag-sites
Perfect – thank you very much!

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


Powered by Kunena Forum