Re: shtml includes

From: Date: Sun, 01 Jul 2001 11:57:17 +0000
Subject: Re: shtml includes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55726@lists.php.net to get a copy of this message
Jamie Saunders wrote: > What I would like to happen is for the PHP script to be able to look for the > <!-- include --> tags within the text files and parse them as PHP > include(""); tags. Is there any way of achieving this? It can be done with regular expressions (but i'll leave that to someone who is GOOD at them :) The problem is that for a php program to parse a file (so stuff) it has to be named with a .php extension (or whatever your server is set up to do), so nested includes will fall over. I'd just like to point out however that if you do this, you'll put a long term burden and performance issue into your site. If you grab a decent text editor, and do a search and replace accross the whole site (decent text editors can do search and replace on a whole directory or disk), you'll have a once-off chore, rather than giving the server a constant chore. example Search and Replace <!-- include file=" with <?php include(' the search and replace .txt" --> with .php'); ?> so <!-- include file="stuff.txt" --> becomes <?php include('stuff.php'); ?> easy. the bad bit is that you've got to then go and rename each extension .php instead of .txt, but you are going to have this problem with either method, due to the nested natur of your inlcude files. how many files in total are we talking about (the includes and nested includes, not the parent pages)? Justin French Creative Director Indent.com.au

« previous php.general (#55726) next »