PHP
PHP Caching object for XCache or eAccelerator
Posted January 17th, 2008 by zeger
Since caching should be an integral part of any (homebrew) CMS a simple static caching object is discussed for both the XCache and eAccelerator modules in PHP.
Failsafe when using JSON to load HTML data through PHP and AJAX
Posted November 2nd, 2007 by zeger
When we use JSON to load data into PHP from an external source we could run into some 'double-quote' problems when decoding the JSON string. By using a fairly simple regular expression we make sure the JSON string is still valid.
MySQL based PHP session handling, InnoDB or MyISAM?
Posted November 1st, 2007 by zeger
When building a serious website you should always use a database for the session handling; this has several advantages of which session sharing between web servers [load balancing] is a key feature. Usually MySQL is the database of choice for PHP programmers, when using MySQL we can choose between two table types: InnoDB or MyISAM. Which type to choose for database session handling?
Simple (secure) database object
Posted October 30th, 2007 by zeger
When using JSON as a data transport encoding schema for MySQL the database server should always return a single row; it can be useful (even better: you should) to make use of stored functions for the generation of the JSON data on the database side. A simple database object is shown and discussed.
Note:
Article is still wip.
Firstly note that we should use constants wherever possible; in this example constants are set in the constants.php file.
The object has some specific properties:
-
public function __construct()
Multi language PHP scripting
Posted October 28th, 2007 by zeger
Assume we have to build a multi language website; on this website are several texts which have to be translated: "home", "read more" etc. How should we solve the "translation problem" from a scripting side of view?
When building a website some code with the likes of:
echo '<a href="./read_text.php?' . $id . '"> read more </a>';
can usually be found.
If you would like to extend your website beyond the English language we have to make some adjustments there. Several options can be considered as a solution:
JSON and MySQL
Posted October 28th, 2007 by zeger
We can make an adjustment to the generally accepted use of "fetch row from database and show" by using the GROUP_CONCAT function and JSON function, since we can recursively extend the JSON data this enables us to extend the data transportation mechanism without changing the code.
www.zeger.nl