Keyword

k2 page titles configure

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 8 months ago #161311 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 page titles configure
The site's name is added through your site's global configuration.

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

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

More
7 years 3 weeks ago - 7 years 3 weeks ago #165350 by burnyourears
Replied by burnyourears on topic k2 page titles configure
Hi,

I use this code to place the article-title and the category in the page title. So far it's working:
<?php
$newtitle= (' Review: ' . $this->item->title . ' | ' . $this->item->category->name);
$document = JFactory::getDocument();
$document->setTitle($newtitle);
?>

My problem: When an article has the special character >> ' << , it shows the html-code in the page title instead: #039;

> For example, "Spock's Beard" is getting "Spock#039;s Beard" in the page title.

Any idea how I could fix that?

:-)
Last edit: 7 years 3 weeks ago by burnyourears.

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

  • Ronny Van Der Borght
  • Ronny Van Der Borght's Avatar
  • Offline
  • Senior Member
More
7 years 3 weeks ago - 7 years 3 weeks ago #165353 by Ronny Van Der Borght
Replied by Ronny Van Der Borght on topic k2 page titles configure
Thanks to Krikore (See also gist.github.com/kricore/2c9a5434748c5f5f6cf9)
$safe 		= array("", "");
$nonsafe 		= array("'", "\"");
$custometa 	 = $this->item->title;
$safemeta 	= str_replace( $nonsafe, $safe, $custometa);
echo $safemeta;
Last edit: 7 years 3 weeks ago by Ronny Van Der Borght. Reason: Typo

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 weeks ago #165357 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 page titles configure
Thank you Ronny :)

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

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

More
7 years 2 weeks ago #165456 by burnyourears
Replied by burnyourears on topic k2 page titles configure
Thank you!

Unfortunately I am no coder and need some help how to integrate this within my code ... Where do I have to put the " $safemeta;" ? Something like this (does not work ...) ?
<?php
$safe 		= array("", "");
$nonsafe 		= array("'", "\"");
$custometa 	 = $this->item->title;
$safemeta 	= str_replace( $nonsafe, $safe, $custometa);

$newtitle= (' Review: ' . $safemeta . ' | ' . $this->item->category->name);
$document = JFactory::getDocument();
$document->setTitle($newtitle);

?>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 weeks ago #165464 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 page titles configure
You will need to add this to your item.php overrides.
Make sure to always use overrides :) getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

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

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

More
7 years 2 weeks ago #165476 by burnyourears
Replied by burnyourears on topic k2 page titles configure
Yep, for sure - I know :-)
But I don‘t know where in the code and how to merge with my codesnippet. Hmmm...

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 weeks ago #165490 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 page titles configure
You can place it pretty anywhere in the item.php file.

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

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

More
7 years 2 weeks ago #165495 by burnyourears
Replied by burnyourears on topic k2 page titles configure
Sorry, I don't get it. I tried this:
<?php

$safe 		= array("", "");
$nonsafe 		= array("'", "\"");
$custometa 	 = (' Review: ' . $this->item->title . ' | ' . $this->item->category->name);

$newtitle= str_replace( $nonsafe, $safe, $custometa);
$document = JFactory::getDocument();
$document->setTitle($newtitle);

?>

But the ' still is in the title tag. What do I not understand?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 1 week ago #165559 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 page titles configure
Can you send me a link please?

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

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


Powered by Kunena Forum