[TxMt] PHP echo wrap

Charley Tiggs lists at tiggs.net
Sat Jun 2 23:26:03 UTC 2007


Actually, there are times when I'm "buffering" the output of the html by 
saving the results of the logic into a variable and the ob_* functions 
are not appropriate.  In that case, I need to be able to escape the 
html, whether it's using single quotes or double quotes to define the 
strings.  I don't want anything output until the logic has run it's course.

I'm guessing the original poster has similar requirements.  Not to 
mention that it may well be a matter of preference.

Charley

Eric Coleman wrote:
> Wouldn't it be better not to echo out all that html?  Chances are you 
> don't need to, so escape from PHP mode back into HTML, and write your 
> HTML... the way it should be...
> 
> On Jun 2, 2007, at 6:38 PM, Tobias Jung wrote:
> 
>> At 8:45 Uhr -0700 31.05.2007, luismcdougall wrote:
>>>  I find my self wrapping html code very frequently.
>>>  It is a pain but I do not know how to work with regex,
>>>
>>>  Basically I need to use echo "" to wrap the html code and escape all 
>>> of the
>>>  other " in it.
>>>
>>>  can someone help me?
>>
>> Sorry I can't help you, but wouldn't it be better to use echo '' 
>> (single quotation marks) and leave the HTML " (double quatation marks) 
>> untouched?
>>
>> Example:
>> Before:
>> <a href="some_file.php" title="this is a link">click here</a>
>> After:
>> echo '<a href="some_file.php" title="this is a link">click here</a>';
>>
>> Kind regards,
>> Tobias Jung




More information about the textmate mailing list