how to tell php to ignore html-style comment?
| From: | Hamdouni El Bachir | Date: | Mon, 18 Oct 1999 12:52:43 +0000 |
| Subject: | how to tell php to ignore html-style comment? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11738@lists.php.net to get a copy of this message | ||
hello,
I use Dreamweaver for making HTML pages, it does not help a much for
using php ( it does for ColdFusion and ASP ) .
Happily, php3 uses le <script ...> syntax and the ASP one,
this help for introduce the php text without letting Dreamweaver
destroy it because he think it's HTML errors!
But there is still a problem, when we use DreamWeaver Templates ( we
use this feature a intensively ), he puts some
HTML comments in the pages dependents of a model, something like
" <!-- #Begin...... --> "
The problem is that he always put a line of this kind in top and
nothing can make him change this behaviour. So i can not send "cookies"
nor "Location" ...
What i want to do is to create a page from a Template where this is
some php code and to let my co-workers change the appearance
of the pages without having special operations to do.
So i decided to add a little Feature to php that will make
him not send HTML comment to STDOUT or at least not send the Dreamweaver
kind of comments.
I read some pages about Flex and i added this lines to
"language-scanner.c" before all the <IN_PHP> and it doesn't work
someone could help, please?
<INITIAL>"\<\!\-\-" {
char c;
int start_lineno;
start_lineno=GLOBAL(phplineno);
for (;;) {
while ((c=MY_INPUT())!='\-' && c!=EOF) {
HANDLE_NEWLINE(c);
}
if ((c == '\-') && ((c=MY_INPUT()) == '\-')){
while ((c=MY_INPUT())=='\-');
if (c=='\>') {
html_puts(yytext,yyleng);
break;
}
}
if (c==EOF) {
php3_error(E_WARNING,"Unterminated comment starting line
%d.\n",php3_get_lineno(start_lineno));
break;
} else {
HANDLE_NEWLINE(c);
}
}
}
Hamdouni El Bachir