In my file index.php I have included this text from another file.
<title>
<?php
$title = "";
if (basename(__FILE__, ".php") == "index") {
$title = "Home";
} else {
$title = ucfirst(basename(__FILE__, ".php"));
}
echo $title;
?>
</title>
And I guess you can see what i does, and if not, then it's supposed to set the title to the basename of the file. So say you have a file called downloads.php, then the title with this script would be Downloads. But I have this problem which I don't know how to get past. When I include the text via.
<head>
include "filename.php";
</head>
And my problems is when I include the text, the 'script' runs before it includes. Say if the name of the file you included is filename.php and the main page where you have included the text is main.php, the header would be Filename and not Main. And the reason why I want to include the text, and not just paste directly into main.php is because it's much easier to edit if you have multiple files where you need the exact same code.
I hope you understand what I'm asking, and that you are able to help me.