php with hypertext

Discuss syntax highlighting or submit new syntax files.
Post Reply
ufku
Posts: 12
Joined: 08 Aug 2006 01:40

php with hypertext

Post by ufku »

i tried to combine php syntax with html syntax for html containing php files. the result is just a broken head.
i added php functions and keywords to html syntax. it didnt help. i added a <? ?> block with higlight keywords. it didnt help.
i tried the reverse in which i added tags to php syntax. again i got nothing.

if the tags are in action, the rest are considered as plain text. there is no way to higlight keywords in that text. i tried defining php blocks(BlockAsString=no, BlockOnLine=No, BlockStart=<?, BlockEnd=?>) but it didnt work.

i think if the engine considered "<?php" as a tag, there would be a situation like the javascript tag in which the keywords are higlighted. am i wrong?

User avatar
Rickard Johansson
Site Admin
Posts: 6012
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

Maybe it's better to use multiple highlighters. Maybe a line in the Html syntax file that loads the PHP syntax as well. Whenever a <?php is encountered the PHP syntax kicks in, and when the > is encountered the HTML syntax is used again. Just a thought.

jerry1970
Posts: 229
Joined: 25 Jul 2006 07:41
Location: Netherlands

Post by jerry1970 »

Rickard Johansson wrote:Maybe it's better to use multiple highlighters. Maybe a line in the Html syntax file that loads the PHP syntax as well. Whenever a <?php is encountered the PHP syntax kicks in, and when the > is encountered the HTML syntax is used again. Just a thought.
Sounds great! But don't forget that the HTML syntax should be taken up where it was left off. For example:

Code: Select all

<p>Hello, <b><?php echo $name; ?></b>!
Or maybe a better example:

Code: Select all

<font size="<?php echo $fontsize; ?>">Hello!</font>
EditPlus has these syntax file directives:
#HTML_EMBEDDED=y
#SCRIPT_BEGIN=<?
#SCRIPT_END=?>

Jerry

User avatar
Rickard Johansson
Site Admin
Posts: 6012
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

I'm not sure about the PHP highlighting inside a string. I think a string should be highlighted as a string. Anything else just seems wrong, some how.

jerry1970
Posts: 229
Joined: 25 Jul 2006 07:41
Location: Netherlands

Post by jerry1970 »

Rickard Johansson wrote:I'm not sure about the PHP highlighting inside a string. I think a string should be highlighted as a string. Anything else just seems wrong, some how.
When I'm programming PHP, I am *very* glad to see the PHP code syntax coloured as PHP code, and not as an HTML string. PHP is embedded into HTML - both should be separate entities and thus have their own syntax colouring.

Jerry

User avatar
Rickard Johansson
Site Admin
Posts: 6012
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

PHP is embedded into HTML - both should be separate entities and thus have their own syntax colouring.
Well, if you put it that way it accually sound reasonable. :)

jerry1970
Posts: 229
Joined: 25 Jul 2006 07:41
Location: Netherlands

Post by jerry1970 »

Rickard Johansson wrote:
PHP is embedded into HTML - both should be separate entities and thus have their own syntax colouring.
Well, if you put it that way it accually sound reasonable. :)
Hey, I am a programmer too, I am supposed to be able to make things sound logical and reasonable! :D

Post Reply