Re: <?php= ?> sytanx again

From: Date: Thu, 08 Nov 2001 01:42:45 +0000
Subject: Re: <?php= ?> sytanx again
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-69780@lists.php.net to get a copy of this message
Jason Greene wrote:
> I use that functionality on alot of pages that are mostly html, and it makes the source a lot
> easier to read. 

IMHO everybody here misses the most important point.

The <?= ?> suffers from the same second order problems as the <?php echo
?>, i.e. in most HTML-editors it is treated (rightly) as a html-tag,
i.e. not visualized (other than as an icon.)

When I develloped Html2Mod a couple of years ago (no longer available
now that I joined the php bandwagon, it would create modula-2 sources of
a html file with embedded tags like PHP was to do some years later) I
used square brackets [VarName] to print out variables (and only
variables.) 

The main difference with <?= ?> being that they would be printed "as is"
on any wysiwyg html-editor, and *that* is what makes your code readable.

However, you do need a mode to escape this auto-print mode.

I know I'm not the first to suggest this: Create a language construct
that will expand variables embedded in square brackets. There should be
no whitespace inbetween the brackets.

  [$VarName]      
would expand to 
  <?php echo $VarName; ?>


Thread (57 messages)

« previous php.dev (#69780) next »