AJAX with care


AJAX/JSON is an extremely cool technology - using javascript to request content from servers for display. There is absolutely know doubt in my mind that it will be an important part of rich user experiences in the future of the web.

But - it shouldn’t be used everywhere. The complexity to really make it fly is expensive. If you have a simple page, or a low traffic page, or a basic application, attempting to add the layer of javascript necessary to manage the client-server communication is probably not worth it.

The Internet Explained


Developing PHP5 code on a PHP4 server, that also has PHP5

.htaccess to run PHP5 on a server that defaults .php to PHP4, when your ultimate target is a PHP5 server.

.htaccess file

RewriteEngine   On
RewriteRule   ^index.php5$      - [L]
RewriteRule   ^exec.php$        - [L]
RewriteRule   ^(.*)\.php5?$     index.php5?page=$1
DirectoryIndex  index.php5

The advantage of this architecture is that since all the pages are delivered through index.php5, they are processed as PHP5, although they are named as .php.

Also - if you have a PHP5 application, you MAY be able to use the same approach, if you put PHP5 and PHP4 on the same server.

dojo validation

This is a dojo validation loop. Send it an array of input ids (with dojoTypes), and it will ensure they’re valid.

function checkValid(aValid)
        var i,e;
        for (i=0;i<aValid.length;i++)
                if (!e.readOnly)
                        if (typeof e.isValid != 'undefined')
                                if (!e.isValid())
                                        return false;
        return true;

PS - Visit http://dojotoolkit.org with FireFox, not IE

Ini processing into javascript

echo '<pre>';
echo '</pre>';
echo '<hr />';
extract ($ini_array);
echo 'Database: '.$database.'<br />';

This is the beginning of an adventure - to use PHP to inject strings into javascript for AJAX applications. Multi-lingual, fast and efficient. More posts later. Will probably require Apache adjustments to run .js files through PHP, but that’s okay!!!