From: Paul M Foster
> Here's a hairbrained idea I was kicking around. I object to the idea
> including 15 or 30 files in a PHP application just to display one page
> on the internet. It makes the coding faster, but it makes the display
> slower and seems silly to me.
> So what if you had a tool or a set of tools where you could write code
> snippets and such, and then hit a button or issue a command, and
> everything you specified got written into a single file? You'd specify
> that this page needs to read the config, set up a database connection,
> validate these fields, etc. When you were done, it would write all
> code to a *single* file, which the user would invoke by surfing to
> page. The resulting code would be *static*, not like what results from
> most templating systems. So rather than specify a specific variable
> value in the resulting file, it would embed the PHP code to display
> variable, etc.
> What might be the liabilities of something like that? Would there be
> security issues? Would there be increased difficulty in debugging?
> can you think of?

Programs to do that used to be called compilers. There is an entire
branch of computer science and a lot of tools (lex, yacc, etc.)
dedicated to that topic.

It's not a bad idea, but there is one precarious assumption that
underlies it. Can you absolutely guarantee there will never be a second,
or third, or more pages on that server that will need some of those
functions or classes? As soon as the site begins to evolve and grow, you
will have multiple copies of many of those snippets, and when (not if)
you need to modify them, you will have to find and change every single

So you need to ask yourself if this strategy is maintainable in your
case. And will it make any real difference in the end?

Bob McConnell

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to