将变量插入标题问题

I'm adding some usability stuff to a friend's site, and he already uses some custom CMS that I'm not familiar with. Basically, it's a portfolio, and the project name needs to be in the title of the page. The PHP can be seen here:

http://cl.ly/170H462w1x2X0Q1R0p2P

I've tried quite a few things, but this is where I last tried:

<TITLE>The Preeminent Anthology of Alec Brownstein - <?php echo $title; ?></TITLE>

...which does nothing. Also did $pid which just gives the number of the project. Thanks for any help or insight.

You can put this part of the php code above the head

include("lib/db.inc");
include("lib/default_table.class.inc");
include("lib/cms.class.inc");
$points = array();
$projectid = $_GET['pid'];
$dbobjectProjects = new Projects;
$dataProjects = $dbobjectProjects -> getData(NULL);

$projects[0] = '';

foreach($dataProjects as $line) {
    $projects[$line['pr_id']] = $line['pr_title'];
}

$title = $projects[$projectid];

This will give the title of the current project in $title variable.

It appears that the HTML begins before any PHP is executed, and the <title> tag is coded before the variable $title gets a value:

$title          = $line['pr_title'];

You will not be able to place any PHP output into the upper part of the HTML unless the relevant PHP code is moved to occur before the <head> tag.

A large amount of code reorganization may be necessary to make that happen.