[PHP] Re: $html_code .= include ("filetoinclude.txt");

2002-10-13 Thread @ Edwin
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" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > 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.
> >
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: $html_code .= include ("filetoinclude.txt");

2002-10-13 Thread John W. Holmes

No. That will not work. Include does not return the text to a variable.
Please read the manual page on include. You have to use file, fopen, or
include() _with_ output buffering in order for this to work.

---John Holmes...

> -Original Message-
> From: CJ [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, October 12, 2002 3:09 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: $html_code .= include ("filetoinclude.txt");
> 
> 
> $html_code = $html_code.include("filetoinclude.txt");
> 
> 
> Research And Development wrote:
> > 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.
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: $html_code .= include ("filetoinclude.txt");

2002-10-13 Thread Shawn McKenzie

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" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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.
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: $html_code .= include ("filetoinclude.txt");

2002-10-13 Thread CJ


$html_code = $html_code.include("filetoinclude.txt");


Research And Development wrote:
> 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.
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php