I meant to use highlight_file instead of highlight_string, doh!
I'll go back in time and modify the source below :)

Philip

On Thu, 4 Apr 2002, Philip Olson wrote:

> 
> A note exists at http://www.php.net/highlight_file that says:
> 
>   Note:  The return parameter became available in PHP 4.2.0. Before 
>          this time it behaved like the default, which is FALSE
> 
> So if you want to capture the output of highlight_file before 
> 4.2.0 then you'll need to use output buffering, something like:
 
    function ob_highlight_file($filename) 
    {
      ob_start();
      highlight_file($filename);
      $source = ob_get_contents();
      ob_end_clean();
  
      return $source;
    }
 
> Be sure to pay attention to notes and warnings within the 
> PHP manual.
> 
> Regards,
> Philip Olson
> 
> 
> On Thu, 4 Apr 2002, Hugh Bothwell wrote:
> 
> > using PHP 4.1.3-dev on WinME, I call
> > 
> >     $a = "str" . highlight_file("file.php", true);
> > 
> > and get a warning,
> > 
> >     Warning: Wrong parameter count for highlight_file() in myfile.php
> > 
> > and *don't* get the highlighted source I want.  show_source()
> > does precisely the same thing.
> > 
> > The manual says that PHP version >= 4.0.0 should support
> > a second optional parameter... why would this fail?
> > Is there some other easy way to do this?  I have to get it returned
> > in a string to stuff it into my template.
> > 
> > 
> > 
> > -- 
> > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to