
So you've got a project that requires support for multiple languages and aren't sure where to begin. It can be a daunting task if you are starting from scratch. No worries, it's not as bad as you think. To make things simple, I will break it into a few parts.
Determine A User's Preferred Language
There are a number of methods you can use to figure out what language a user prefers. The one you should start with being the
$_SERVER['HTTP_ACCEPT_LANGUAGE'] variable. The value of this variable is supplied by the user's browser. It's basically a comma-separated list of language locals arranged in order of priority (first being the preferred language). Beyond that, you can include a language selection form or link on the website which will allow the user to select their preferred language.
Here's some sample code for retrieving the user's preferred language:
<?php
$user_lang = '';
if (strpos
...
... read more

Skipping all the boring stuff about what
AJAX is, let's dive right in. I'm going to demonstrate how you can use AJAX to submit a form for processing by a server side script and have the result fill a specified element on the page.
Here's a working example:
In the above example, a PHP script is called upon submission of the form. The script takes the text from the input field and creates an image. The script then returns a simple HTML img tag with the URL path of the newly created image as its src attribute. Sounds simple enough... Now how it works...
First, you'll need to insert the following between the <head> tags of your website:
...
... read more

While working on a project recently, I needed a way to create an image from a text string on the fly so that headers for forms, lists, and pages could be consistent with the rest of the website. I accomplished this by creating one function that uses PHP's image functions to take a specific string of text and create a png image.
Try it:
Here's the function that does the magic:
<?php
/*
Renders text as an image.
...
... read more