Re: [PHP] shtml includes

2001-07-03 Thread Christian Reiniger

On Sunday 01 July 2001 13:57, Justin French wrote:

 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.

[...]

 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

No need to rename them. They're only accessed via include(), so PHP 
parses them regardless of the filename.

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

...1000100011010101101010110100111010113...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] shtml includes

2001-07-01 Thread Jamie Saunders

Hi,

In my site  I use shtml extensively.  Therefore I have quite a number of
text files that serve as shtml includes.  Often these text files contain
more shtml includes.  I'm creating PHP pages and wish to use these text
files within the pages, I know how to do this easily enough by using:
include(textfile.txt);  The problem is that because a lot of these text
files contain more includes the PHP pages are passing them over, as it
cannot deal with the shtml !-- include -- tag.  Here's a brief example:

script.php:
?
include(text1.txt);
?

text1.txt:
html
!-- include file=text2.txt --
/html

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?

Thanks.

Jamie Saunders



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] shtml includes

2001-07-01 Thread Justin French

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]