page.php:
<?php
include("header.php");
$title = "TITLE";
?>
header.php:
<title><?php echo $title; ?></title>
I want my title to be set after including the header file. Is it possible to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
expanding on Dainis Abols answer, and your question on output handling,
consider the following:
your header.php has the title tag set to
<title>%TITLE%</title>;the “%” are important since hardly anyone types %TITLE% so u can use that for str_replace() later.
then, you can use output buffer like so
and that should do it.
EDIT
I believe Guy’s idea works better since it gives you a default if you need it, IE:
<title>Backup Title</title>