30th April, 2008 at 12:40 PM PDT · Filed under Code, PHP
Although you can use variables within strings in PHP, you can’t do functions. Well, not quite. If your function name begins with a dollar sign ($), it works fine. You can exploit this to call non-object functions such as htmlspecialchars.
<?php
$F = "F";
function F($s) { return $s; }
$filename = '<some code>';
echo "{$F(htmlspecialchars($filename))}";
It’s still not as clean as if you had separated application logic and presentation code like you should have. >:o
15th August, 2007 at 11:19 AM PDT · Filed under Code, JavaScript, Programming
CodePress and EditArea have become rising stars of the edit-code-in-your-browser scene, but which one fits your needs?

EditArea, hands down, has the features. There’s cut and paste, full block/line forward and backward tabbing, search and replace, smart tabs, and spaces as tabs. So what’s the catch? EditArea loses its charm when you become friends with its slow response time. A file with 500 lines is a no-no. EditArea aligns another layer over a TEXTAREA element to color code the text. The bottom line: go for EditArea if you want the features, sacrificing speed.

CodePress instead uses an IFRAME with edit mode enabled, giving CodePress the response time akin to a native text editor, but CodePress lacks many of the “vital” features. You won’t find smart tabs, spaces-as-tabs, tabbing blocks of code forward and backward, and the ability to paste cleanly to outside the editor. The bottom line: go for CodePress if you want to edit large files.
By the way, there are two more options: CodeArea 2 and Helene. The former uses the same mechanism as CodePress, but it has unfortunately fallen out of development. Helene was one of the first (if not the first) to edit code, but it does itline by line, so the interface is a little awkward.