Re: highlight_file modification
| From: | Sascha Cunz | Date: | Thu, 12 Sep 2002 01:15:36 +0000 |
| Subject: | Re: highlight_file modification | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-88224@lists.php.net to get a copy of this message | ||
> http://www.dapond.net/code/bleh.html
>
> This still doesn't implement the .phps?linenumbers (since that's gonna have
> to do with the server module/cgi binary code) and also since nobody's (yet)
> given input as to what variable name would be sufficient.
at least SG(request_info).query_string contains the full (unparsed) query
string at this moment.
> show_line_numbers? Headers/footers will also have to go in the server
> module/cgi code to implement XHTML/1.1 for the output, since I can't think
> of a way to figure out whether zend_highlight() was called from the
> apache_php_module_main function (or, simply to tell whether or not it was
> called from anywhere other than highlight_file/highlight_string).
Ignoring the use of show_source(file) currently the apache, cgi, cli, pi3web
and servlet sapis are able to produce highlited source. None of these SAPIs
will send correct HTML, since <HTML> and <BODY> are missing. I think, in a
web-server environment, they should do so, shouldn't they?
But what about the CLI? I could imagine, one uses this to parse PHP-Code into
printable form.
Anyway - after walking through all these SAPIs - one way to figure out,
whether zend_highlight was called from highlight_file/highlight_string or not
is:
Adding a flag to the zend_syntax_highlighter_ini-structure, initializing it to
FALSE in php_get_highlight_struct (All SAPIs and the PHP-Function
highlight_file etc. use this way to create it; i wonder why zend_highlight
doesn't get this structure itself?). By setting this flag to TRUE, you can
omit sending a header from the PHP-Functions.
I know, this is a kludge, but at least it's an option.
Sascha