Heavy Changes in htdocs/* required
Manuel Holtgrewe <[email protected]> Mon, 14 Mar 2005 13:03:07 +0100
| Newsgroups | gmane.comp.lib.binarycloud.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi
I implemented a HTTPResponse class and Project uses it now to generate
the headers. However, in order for Nodes to be able to change the
Headers, they have to be sent *after* the Node rendering tree.
This means some changes - for example Debug cannot simply print its
output to the user on shutdown. A htdocs file now looks like the following:
<?php
/**
* -File $Id: index.php 8382 2005-03-14 11:30:52Z manuel $
* -License LGPL (http://www.gnu.org/copyleft/lesser.html)
* -Copyright 2003, Manuel Holtgrewe
* -Author manuel holtgrewe <purstorm at teforge dot org>
*/
// Set system constants and make essential functions available
require_once('binarycloud.php');
// Initialize the system
include_once('binarycloud/init/Project.php');
$project =& Project::getInstance();
$project->startup();
/* Send page output
*/
{ // try {
$Page =& $project->getPage('app/top/ndf/index.ndf.xml');
} if (catch('Exception', $e)) {
$output = '<strong>Error in Project::getPage() :</strong>' .
$e->toString();
} else {
$output = $Page->getOutput();
}
$project->shutdown();
echo $output;
$debug =& Debug::getInstance();
echo $debug->getOutput();
?>
The main changes are that the output is assigned to a temporary variable
$output everywhere before project shutdown (headers are sent on Project
shutdown). Debug's output has to be retrieved and echoed manually.
Somehow jcm's sed script did not work for me and I could not find a
useful perl script etc. for such things :/ You could automatize the
update by the following steps:
* replace 'echo "<strong' by '$output = "<strong'
* replace 'echo $Page' by '$output = $Page'
* replace '$project->shutdown();' by '$project->shutdown();\necho
$output\n\n$debug =& Debug::getInstance();\n $echo debug->getOutput();'
Regards,
Manuel
--
GPG key: http://www.ggnore.net/~mholtgrewe/personal/files/public_key.asc
_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev