Archive for the ‘ PHP ’ Category

One Click Installation Web Applications

Posted by

The one click installation of our web library has been updated to support the hosting of following applications:

  • WordPress
  • BuddyPress
  • Joomla! CMS
  • CMS Made Simple
  • Geeklog – The Ultimate Weblog System
  • b2evolution – blog/CMS engine
  • phpBB – Open Source Bulletin Board Software
  • Bbpress – Fast Forum Software from WordPress
  • Concrete5 – a CMS managed from anywhere
  • Vanilla Forums
  • RoundCube WebMail
  • MediaWiki
  • Openads
  • Drupal CMS
  • SilverStripe CMS
  • Coppermine Photo Gallery
  • Form to Email
  • Website Search
  • Guestbook
  • Domain Name Checker
  • 404/500 Error Page
  • Trouble Ticket Express
  • Typo3
  • MODX
  • osTicket
  • Squirrel Mail
  • Elgg
  • Moodle
  • Simple Machines Forum
  • ZenPhoto
  • mantisBT
  • PhpMyFAQ
  • Textpattern

Need help hosting or migrating any of the above contact us.

Geocode from Google API V3

Posted by

If you want to get the latitude and longitude from an address using PHP then try the following code snippet:

$geoResult = file_get_contents('' . urlencode($addressString) . '&sensor=false&key=API');
if ($geoResult !== FALSE) {
$output= json_decode($geoResult);
@$lat = $output->results[0]->geometry->location->lat;
@$long = $output->results[0]->geometry->location->lng;
if ($output->status == 'OK') {
if ($lat > NULL) {
//do something

PHP: Write to a file

Posted by

The following code writes to a file, it will overwrite the current contents of the file:

$string = "file contents goes here";
$myFile = "file.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $string);

Make sure you give file.php write access on the server (Apache chmod 775 normally works).

PHP: Limit a strings characters

Posted by

This function will limit the number of words shown if the total character limit is over a certain number and add … after the string. Very useful if you want to trim titles or anywhere where you are limited by space:

function limitCharacters($string){
$count = strlen($string);
// change 50 to the number of characters you want to check for
if($count > 50){
//change 5 to the number of words you want to limit to.
//change ... to anything you want to use to show its clipped
$newstring = implode(' ',array_slice(explode(' ',$string),0,5)).'...';
$newstring = $string;
return $newstring;

To call the function simply use:


Drupal CCK Autonumber Field

Posted by

In a Drupal site you may have a content type that needs an auto number to be generated that auto increments on each new node of that type.

To do this install the computed field module

Then create a new field of the type computed field and add the code from the following URL

Increase the memory available to PHP

Posted by

If you get out of memory errors in PHP or if Drupal suggests you increase the memory available to PHP then you can do this with the following line of code:


In Drupal the best place to put this is in the settings.php file found in sites/default/