From:             vask at dmglobal dot net
Operating system: All
PHP version:      5.3.0alpha2
PHP Bug Type:     Feature/Change Request
Bug description:  Incorrect Code Styling When Mixing Languages (PHP Side And 
Text Editor Side)

Description:
------------
The ONLY way you can ensure that the correct code styling is done is if
there is some kind of "separator" between different languages mixed in the
same file.

The current implementation of PHP doesn't ALWAYS allow for a "separator"
when mixing different languages such as HTML, JS, PHP, etc...

With most things we are ok.. there are already separators that can be
recognized by a text editor...
ie) 
<?
<script>

However, there are cases where a text editor will be unable to realize the
language change is present because a "separator" will NOT be present...
like if something is in quotations... Below is the easiest example I can
think of.

ie)file.html.php
<? $variable = '<p>Don\'t ' . $_GET['verb'] . '</p>'; ?>
- incorrect html code styling (should NOT be a solid color). 
- requires \' or fiddling with the quotations.

ie)file.abc (THEORETICAL)
<? $variable = ?><?html <p>Don't ?><? . $_GET['verb'] . ?><?html </p> ?><?
; ?>
- correct html code styling.
- No need to escape or fiddle with the apostrophe in "Don't."

NOTE: Two separate syntaxes (<? or <?= ) would ONLY be needed for the
SERVER side language (PHP).

My suggestion may be ignored by the PHP community but I think people would
love to see something fill in gap when it comes to code styling AND mixing
different languages together...

Please also note that this proposal is intended for mixing an UNLIMITED
number of client side languages in the same file by a valid PHP separator
(NOT just HTML and PHP).

My original issue is posted here:
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_23658501.html#a22442342

Reproduce code:
---------------
<? 
// See bug description (this is essentially a repeat of what was mentioned
in there...)

// file.html.php
// incorrect html code styling (should NOT be a solid color). 
// requires \' or fiddling with the quotations.

$variable = '<p>Don\'t ' . $_GET['verb'] . '</p>';

//----------------------

// file.abc
// THEORETICAL EXAMPLE
// Correct html code styling.
// No need to escape or fiddle with the apostrophe in "Don't."

$variable = ?><?html <p>Don't ?><? . $_GET['verb'] . ?><?html </p> ?><? ;


?>


Expected result:
----------------
// Text editor displays correct code styling when mixing different
languages together.

// This feature request is about creating a "separator" in PHP so that the
correct code styling will ALWAYS be possible in a text editor when mixing
different client side languages in the same file.

// ie)
// <?html
// <?js
// <?php
// <?client_side_language_154

Actual result:
--------------
// Text editor displays incorrect code styling when mixing different
languages together because a recognizable "separator" between languages is
NOT present.


-- 
Edit bug report at http://bugs.php.net/?id=46046&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=46046&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=46046&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=46046&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46046&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=46046&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46046&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46046&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46046&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46046&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46046&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=46046&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=46046&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46046&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46046&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46046&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46046&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46046&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46046&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46046&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46046&r=mysqlcfg

Reply via email to