Alternatively you could use output buffering. Very rough example:
view.php
PHP Code:
<?php
$title = 'This is the HTML title!';
echo 'Hello world!';
template.php
PHP Code:
<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<?php echo $content; ?>
</body>
index.php
PHP Code:
<?php
ob_start();
include('view.php');
$content = ob_get_clean();
include('template.php');
Basically this will first execute the file view.php (which sets $title) and store the result in $content. The variable $content can then be used in the template.php.
Again, the example is very rough but I hope you get the idea. If not I'd be happy to elaborate
Bookmarks