How to set dynamic title ?
This is my header file where i want to set title dynamically.
<!DOCTYPE html><html lang="en"><head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php $title ?></title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/custom.css">
</head>
<body>
the file from where i want send title
<?php
include "layout/header.php";
include "layout/footer.php";
$title = "my title";
?>
My Answer:
You can set a dynamic title in your PHP header file by using a variable to store the title and then echoing it within the
php
$title = "Dynamic Title Example";
?>
Welcome to my website
This is a dynamic title example.
In this example, the variable $title is set to "Dynamic Title Example" and then echoed within the
Rate this post
4 of 5 based on 8291 votesComments