Page 1 of 1

Help with file inclusion

Posted: Sat Apr 01, 2006 5:53 am
by kamatsu
Hello, I am currently working on a simple content management system for my website and hopefully others.

I have a series of files (html) and I previously have simply been include() ing them into my design dynamically..

Suppose I had this file:

Code: Select all

Hello World!
And I added this:

Code: Select all

Hello World ~~~IncludeFile:otherfiletoinclude.php~~~
I would then like to be able to read the file, and include the file specified there, so the eventual output would be:

Code: Select all

Hello World   This is the contents of otherfiletoinclude.php
At first glance this didn't seem to daunting, I used regular expressions to find the ~ indicated area, and replaced them with <?php include('blah'); ?>. However I would now like to pass this to the PHP interpreter, as if it were a seperate file, so that the include statements are processed. Do i have to write it to a temporary file to do this?

Blah, may be hard to understand, sorry bout that.

Posted: Sat Apr 01, 2006 7:02 am
by John Cartwright
I don't see the point of this at all.. why not let php handle this? No use creating a completely new syntax..

Code: Select all

Hello World <?php include 'otherfiletoinclude.php'; ?>


Make sure you change the extension to .html to .php or add the addHandler .html to be interpreted

well

Posted: Sat Apr 01, 2006 9:59 pm
by kamatsu
The reason that is not feasible is that the user will be using a tinyMCE richtext editor to create content, and if i want them to include a module (e.g an RSS aggregator or poll or something) within a content page, it is irrational to expect them to be able to go and open up the HTML source and type some PHP code in, the user will be typing the ~~~ tags in and i would like my CMS to convert those: it shouldn't be too difficult.