Keyword

k2 page titles configure

More
7 years 5 months ago - 7 years 4 months ago #165567 by burnyourears
Replied by burnyourears on topic k2 page titles configure
That is the actual setting for the individual Page-Titel-Tag (which I somehow tried to integrate wit the "$safemeta;"-Code above – and failed)
<?php
$newtitle= ($this->item->title . ' | Review');
$document = JFactory::getDocument();
$document->setTitle($newtitle);
?>

When I delete that part of the code, everything is fine and "Spock's Beard" looks fine as it should. So it must have something to do with the posted snippet ...
Last edit: 7 years 4 months ago by burnyourears. Reason: Deleting a link to the page.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 5 months ago #165575 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 page titles configure
Try this instead.
$safe 		= array("", "");
$nonsafe 	= array("'", "\"");
$safemeta 	= str_replace( $nonsafe, $safe, $this->item->title);
$newtitle   = (' Review: ' . $safemeta . ' | ' . $this->item->category->name);
$document   = JFactory::getDocument();
$document->setTitle($newtitle);

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

More
7 years 5 months ago - 7 years 4 months ago #165579 by burnyourears
Replied by burnyourears on topic k2 page titles configure
Thank you, but it does not help or change anything (just relocated the "review" in the code, but it should not have an impact because your version does not work either ...).

That's the code I use:
<?php
$safe 		= array("", "");
$nonsafe 	= array("'", "\"");
$safemeta 	= str_replace( $nonsafe, $safe, $this->item->title);
$newtitle   = ($safemeta . ' | Review - XXX');
$document   = JFactory::getDocument();
$document->setTitle($newtitle);
?>

Any further idea? :/
Last edit: 7 years 4 months ago by burnyourears.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 5 months ago #165605 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 page titles configure
What does this produce in your override?
<?php
$safe 		= array("", "", "", "");
$nonsafe 	= array("'", "\"", "", "#039;", "&amp;");
$safemeta 	= str_replace( $nonsafe, $safe, $this->item->title);
echo $safemeta; 
?>

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

More
7 years 5 months ago - 7 years 4 months ago #165610 by burnyourears
Replied by burnyourears on topic k2 page titles configure
Ahhh, thank you! Better ... now it's "Spock&s Beard" instead of "Spock's Beard", bute we're getting to the core ;-)

One last idea?

That's the code right now:
<?php
$safe 		= array("", "", "", "");
$nonsafe 	= array("'", "\"", "", "#039;", "&amp;");
$safemeta 	= str_replace( $nonsafe, $safe, $this->item->title);
$newtitle   = ($safemeta . ' | Review - XXX');
$document   = JFactory::getDocument();
$document->setTitle($newtitle);
?>
Last edit: 7 years 4 months ago by burnyourears.

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

More
7 years 5 months ago - 7 years 4 months ago #165611 by burnyourears
Replied by burnyourears on topic k2 page titles configure
Ok, I experimented a bit with your code and now I have it:
<?php
$safe 		= array("'");
$nonsafe 	= array("&#039;");
$safemeta 	= str_replace( $nonsafe, $safe, $this->item->title);
$newtitle   = ($safemeta . ' | Review - XXX');
$document   = JFactory::getDocument();
$document->setTitle($newtitle);
?>

So your ideas lead to that point I could make it – thank you very much! :D
Last edit: 7 years 4 months ago by burnyourears.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 4 months ago #165621 by Krikor Boghossian
Replied by Krikor Boghossian on topic k2 page titles configure
You 're welcome, and I'm glad I could assist you :)

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

More
4 years 3 months ago - 4 years 3 months ago #177912 by Wilfried
Replied by Wilfried on topic k2 page titles configure
<?php
$newtitle= $this->item->extraFields->EXTRAFIELDALIASHERE->value;
$document = JFactory::getDocument();
$document->setTitle($newtitle);
?>
Hi,
I used this solution to add the tag <title> to each page of my website. The result is ok, but the extrafield is visible in frontend. Is it possible to hide the extrafield in the frontend and only have the option in the backend?

Example: the word "Test" appear in the navigator and the extrafield "Balise title:" is visible before the video.
www.cryptoseries.fr/series/item/445-huff

Sorry for my english, I am french.
Last edit: 4 years 3 months ago by Wilfried.

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

More
4 years 3 months ago #177916 by Wilfried
Replied by Wilfried on topic k2 page titles configure
If anybody have an idea? I can add explanation or maybe provide more examples?
Thanks

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

More
4 years 3 months ago #177931 by JoomlaWorks
Replied by JoomlaWorks on topic k2 page titles configure
Create an override (if you haven't done so already) and remove the extra fields loop. If you choose to hide extra fields in the options of the category they may not render at all (if I recall correctly).

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

More
4 years 3 months ago #177939 by Wilfried
Replied by Wilfried on topic k2 page titles configure
Hi and thank you Fotis for your answer.
I have already an override. I am not an expert in programming. Which loop are you talking about?

In the editing options of the extrafield, I have to choose "text" if I want to add content. And the "text" category don't allow me to hide the tag in the frontend. Visitors will see the content of the tag and I only want this tag for changing the tag title.
I hope that you can understand my message.

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

More
4 years 3 months ago #177957 by JoomlaWorks
Replied by JoomlaWorks on topic k2 page titles configure
Either delete this entire block github.com/getk2/k2/blob/master/components/com_k2/templates/default/item.php#L244-L264 or just put code comments around it so it won't render in your site's frontend.

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

More
4 years 2 months ago - 4 years 2 months ago #177979 by Wilfried
Replied by Wilfried on topic k2 page titles configure
Ok, it worked, but all the additional extrafileds are hidden now. I only want this extrafield hidden. My purpose it to change the tag title of the page from the backoffice. But in the front it has to be transparent for the visitors.
I'm gonna search again and maybe I will find a solution.
Thak you for your help.
Last edit: 4 years 2 months ago by Wilfried.

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

More
4 years 2 months ago #177991 by JoomlaWorks
Replied by JoomlaWorks on topic k2 page titles configure
Then you need to add an exception in the foreach loop to hide that specific field. See how we check the "header" type field and it should give you a hint.

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

More
2 years 6 months ago - 2 years 6 months ago #180421 by Dejan Bojovic
Replied by Dejan Bojovic on topic k2 page titles configure
This works well for displaying the extra field in Page Title

<?php
$newtitle= $this->item->extraFields->Naslov->value;
$document = JFactory::getDocument();
$document->setTitle($newtitle);
?>

but if the extra field is empty, the page link is displayed.

Is it possible to display the default page title if the extra field is empty?

sorry find solution:

<?php
$doc = JFactory::getDocument();
if ( isset( $this->item->extraFields->Naslov->value ) && ($this->item->extraFields->Naslov->value !=='') ) {
    $doc->setTitle('<title>'.$this->item->extraFields->Naslov->value.'</title>');
}

?>

 
Last edit: 2 years 6 months ago by Dejan Bojovic.

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


Powered by Kunena Forum