Meta title tag help

Set a dynamic meta title tag in a Joomla browser tab.

Overview

The issue occurs when using incorrect PHP syntax to insert a dynamic variable into the title.
Remove the quotes around the variable call within the setTitle function to correctly output the dynamic value.

Answered
ChronoForms v7
cr cruser 28 Mar, 2024
Anyone know how to change the title tag in the browser? I found the following code:

<?php 
$document =& JFactory::getDocument();
$document->setTitle("Here is my title");
$document->setDescription("Here my description");
?>


How do I get "Here is my title" to show something like {var:Read.name}?
Max_admin Max_admin 06 Apr, 2024
Answer
use the PHP version:

$this->get("Read.name")
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cr cruser 08 Apr, 2024
Like this?

<?php 
$document =& JFactory::getDocument();
$document->setTitle("$this->get("Read.name")");
$document->setDescription("Here my description");
?>
Max_admin Max_admin 08 Apr, 2024
no, remove the double quotes:

<?php 
$document =& JFactory::getDocument();
$document->setTitle($this->get("Read.name"));
$document->setDescription("Here my description");
?>
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.