On 23 Jun 2004 04:58:07 -0700,
davidaak@yahoo.com (David Johnson)
wrote:
[color=blue][color=green]
>> First of all, why would you ever want to include() an HTML file?[/color]
>
>Sounds like I wouldn't since it doesn't support what I want to do.
>[color=green]
>> readfile() is faster...[/color]
>That's fine but it doesn't support $variables.[/color]
Yeah, but you can str_replace to your hearts content.
[color=blue]
>[color=green]
>>
>> Second, HTML files are not supposed to be "containing $variables";
>> only PHP files are.[/color]
>
>Not supposed to? There's nothing in the HTML spec that prohibits
>text from containing dollar signs.[/color]
Maybe he should have said "Really shouldn't" ?
[color=blue]
>[color=green]
>>
>> Third, what you seem to want is probably achievable with eval(),
>> although I am still at a loss what it is you are trying to accomplish
>> in such a convoluted way...[/color]
>
>Only convoluted if php doesn't support it in a simple function call.
>Which appears to be the case. Funny how it takes longer for people to say
>"I don't know" than almost anything else.
>
>For your information, I am trying to do bare-bones templates.[/color]
For his information? He was trying to be nice in suggesting you post
what you're trying to DO so people could help you.
[color=blue]
>I know
>there are several fine template packages, but I don't want all the
>function or overhead they provide. I want to put all of my html in
>one file with variable names instead of text. The html would never be
>displayed as such so no one but me would see the variable names.
>But I want to use an html editor to edit these files and be able to
>display them in a web browser. My php program would then "include" the
>html file, substituting text for the variables.[/color]
use readinfile to store your file in $htmldoc;
$htmldoc = str_replace(Variable1, $value1, $htmldoc)
$htmldoc = str_replace(Variable2, $value2, $htmldoc)
$htmldoc = str_replace(Variable3, $value3, $htmldoc)
$htmldoc = str_replace(Variable4, $value4, $htmldoc)
echo $htmldoc;
How hard is that?
[color=blue]
>
>php comes very close to supporting this. An included file can contain
>php and a here-doc but that spoils it for display by a web browser.
>If you could imbed an external text file while you're in a here-doc,
>you could get what I'm looking for. But, of course, everything in a
>here-doc is interpreted as straight text, not commands.
>[/color]
Then maybe you should join the PHP team and WRITE it?
--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one!
http://www.databasix.com
================================================== =========================