Re: $html_code .= include ("filetoinclude.txt");
| From: | @ Edwin | Date: | Sun, 13 Oct 2002 11:16:55 +0000 |
| Subject: | Re: $html_code .= include ("filetoinclude.txt"); | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119780@lists.php.net to get a copy of this message | ||
Hello,
The function might be available in the next release so you don't have to
define your own.
http://www.php.net/manual/en/function.file-get-contents.php
But until then...
- E
"Shawn McKenzie" <nospam@mckenzies.net> wrote in message
news:20021013092022.21807.qmail@pb1.pair.com...
> function file_get_contents($filename) {
> $fp = @fopen($filename, "r");
> if (!($fp)) {
> return 0;
> }
> while (!feof($fp)) {
> $temp .= fread($fp, 4096);
> }
> return $temp;
> }
>
> and then: $html_code = file_get_contents(filetoinclude.txt);
>
> HTH
> -Shawn
>
> "Research And Development" <rand@dealante.com> wrote in message
> news:471549A9-DDFA-11D6-83BD-00039384D098@dealante.com...
> > Should this work?
> >
> > $html_code .= include ("filetoinclude.txt");
> >
> > I am populating a variable with html to be printred later as usual:
> > $html_code .= "html....".
> >
> > But I have some static html files that I want included in the html that
> > I am storing in the variable. The HTML is in text files. The above code
> > obviously does not work. I want to know if there is another way.
> >
> > Thanks.
> >
>
>