ID:               48848
 User updated by:  tcjohans at riseup dot net
 Reported By:      tcjohans at riseup dot net
 Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: Windows Vista
 PHP Version:      5.2.10
 New Comment:

The PHP Manual says:

"Using short tags should be avoided when developing applications or
libraries that are meant for redistribution, or deployment on PHP
servers which are not under your control, because short tags may not be
supported on the target server. For portable, redistributable code, be
sure not to use short tags."

I think the request now becomes:

Short tags should be made available to all by enabling scripts to
dynamically set the ini settings for short tags in their scripts.

Thomas

PS! Do you really have to call this "bogus"??


Previous Comments:
------------------------------------------------------------------------

[2009-07-08 10:19:32] tcjohans at riseup dot net

Thank you for your reply, Derick.

I was not aware of that.

However, it appears that the <?=   ?> tagging is available only if you
have control of the php.ini file and can set the short_open_tag setting.


Which creates a problem with portability of scripts and in any event
does not make these tags available to all. I just tried it in my script
and it did not work.

------------------------------------------------------------------------

[2009-07-08 08:08:08] der...@php.net

Uhm, are you not aware that we have this already in the form of:

<?=     ?>


------------------------------------------------------------------------

[2009-07-08 08:02:20] tcjohans at riseup dot net

Description:
------------
Hello,

Here is an idea of how to facilitate the interaction between PHP and
HTML code. Much of this interaction just has to do with the insertion of
the value of a previously defined PHP variable into the HTML document.
Currently, this is done through a rather roundabout coding:

<?php echo $somevariable; ?>

This snippet contains 28 characters, i.e. 16 more than the 12 of the
variable name. Could it be put neater and more economical?

I think so. I would propose a shorter format: 
A simple prefix that simply just tells PHP that what immediately
follows is a PHP variable whose value should be inserted into the HTML
document, but that in all other regards this is just HTML code.
There should also be a closing suffix (but this is perhaps mostly to
give an aesthetically balanced coding.)

E.g. a prefix like "<$php:" and a suffix like ">" (or whatever), so
that one could just write something like

<$php:somevariable>

in the HTML code in order to have the value of $somevariable to be
inserted there.

The 28 characters of the usual way has now become just 19 characters.
And the whole snippet is much more concise and clearer: it gives a
neater appearance within the surrounding HTML code, which facilitates
for the developer/designer.

This would simply be so much more economic and neater than the usual
way.

The idea can be extended:

For instance, in order to call a function somewhere in a piece of HTML
code, one might perhaps do something like this:

<?php:somefunction($var1, $var2)>

Thomas

Reproduce code:
---------------
<?php

function goodbye($a) {
 echo "Goodbye " . $a . "!";
}

$greeting = "Hello World!";

?>

This is some HTML text.<br>
Followed by:<br>
<$php:greeting><br>
<$php:goodbye("world")><br>
End



Expected result:
----------------
This is some HTML text.
Followed by:
Hello World!
Goodbye world!
End



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48848&edit=1

Reply via email to