PHP (or, rather, the Zend scanner) currently recognizes the
following tags as enclosing PHP code:
<?php ?>
<? ?>
<% %>
<script language="php">
The attached patch extends the <script> tag to also except the
<script type="..."> syntax, where the type is the MIME type
signifying PHP code (application/x-httpd-php).
The 'type=".."' attribute is necessary for XHTML 1.0 compliance.
The idea for this addition originated from "Alexander J. Vincent"
<[EMAIL PROTECTED]>.
I've also attached a short test script to demonstrate the new
behavior.
If this patch is accepted, I can also make the appropriate
documentation changes.
--
Jon Parise ([EMAIL PROTECTED]) . Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/ : Computer Science House Member
Index: zend_language_scanner.l
===================================================================
RCS file: /repository/Zend/zend_language_scanner.l,v
retrieving revision 1.35
diff -u -r1.35 zend_language_scanner.l
--- zend_language_scanner.l 2001/08/11 15:57:07 1.35
+++ zend_language_scanner.l 2001/08/14 20:59:26
@@ -1073,7 +1073,7 @@
return T_INLINE_HTML;
}
-<INITIAL>"<?"|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'"){WHITESPACE}*">"
{
+<INITIAL>"<?"|"<script"({WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'")|{WHITESPACE}+"type"{WHITESPACE}*"="{WHITESPACE}*("application/x-httpd-php"|"\"application/x-httpd-php\""|"\'application/x-httpd-php\'"))+{WHITESPACE}*">"
+ {
HANDLE_NEWLINES(yytext, yyleng);
if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not <? but <script> */
zendlval->value.str.val = yytext; /* no copying - intentional */
<?php echo '<h2><?php ?></h2>'; ?>
<? echo '<h2><? ?></h2>'; ?>
<?= '<h2><?= ?></h2>'; ?>
<script language="php">
echo '<h2>language="php"</h2>';
</script>
<script type="application/x-httpd-php">
echo '<h2>type="application/x-httpd-php"</h2>';
</script>
<script language="php" type="application/x-httpd-php">
echo '<h2>language="php" type="application/x-httpd-php"</h2>';
</script>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]