Redirecting PHP output in script

From: Date: Mon, 05 Jul 1999 15:26:15 +0000
Subject: Redirecting PHP output in script
Groups: php.dev 
Request: Send a blank email to php-dev+get-8103@lists.php.net to get a copy of this message
Hi, I have developed a tool for generating web sites from a database, and I'm working on improving the scripting language. It makes sense to choose something familiar, simple and in use for server side scripting. PHP is ideal. Essentially the program would run a script to traverse the database and generate output page-by-page using templates, each template is effectively a separate PHP script. The fact that all output goes to stdout is a bit of a problem. I need to be able to direct the output of a template to a specific file. No big deal really, I have done this using a drop-in module that redirects stdout, but this is far from perfect. Also I would like to allow output to take place through user supplied functions. The way to achieve this is to rewrite the php3_??? output functions to use a global FILE that is manipulated through a new core module implementing functions such as: openoutput(path, mode) closeoutput() flushoutput() registeroutput(func) These would maintain a push-down stack of file details so that when closeoutput() is called output reverts to the previous stream. At present this will only work for the CGI version - fine. The rewrite seems simple if non-trivial. Is this work likely to be of interest or am I on my own in having a use for it? Should I submit any changes I make? How do I do that? Sorry if the latter is a FAQ, I'm doing this on the spur of the moment. From: Sean Wilson Email: seanw@greymatter.co.uk Tel: +44 (0)1364 654 100 Fax: +44 (0)1364 654 200 WebSite: http://www.greymatter.co.uk Post: Grey Matter Ltd., Prigg Meadow, Ashburton, Devon, UK. TQ13 7DF

« previous php.dev (#8103) next »