Warning: include(../_include/preamble.php) [function.include]: failed to open stream: No such file or directory in /www/docs/stridebird.com/articles/index.php on line 5

Warning: include() [function.include]: Failed opening '../_include/preamble.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /www/docs/stridebird.com/articles/index.php on line 5

Warning: include(../_include/fullhead.php) [function.include]: failed to open stream: No such file or directory in /www/docs/stridebird.com/articles/index.php on line 6

Warning: include() [function.include]: Failed opening '../_include/fullhead.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /www/docs/stridebird.com/articles/index.php on line 6

Warning: include(../_include/googleads.php) [function.include]: failed to open stream: No such file or directory in /www/docs/stridebird.com/articles/_showarticle.php on line 52

Warning: include() [function.include]: Failed opening '../_include/googleads.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /www/docs/stridebird.com/articles/_showarticle.php on line 52

Published: 2005-07-06 17:48:43 [ previous | next | back to article list ]

building robust include statements in your PHP code

Introduction

Whilst it's always a good idea to think modular right from the start of your project, what happens if you need to move your files around? Or you want to auto-generate text from a template from any point within your website's structure? Sometimes modular solutions can come back to hang you, requiring a full page-by-page edit of the entire site despite all the best intentions of modular design.

How did it get to this?

The classic include and its cousin, require,
include manual page
require manual page

What to do?