Drupal and PHP 5.3

Drupal CMSDrupal states on it’s site that it doesn’t support PHP 5.3. And, if you attempt to install drupal on a server running PHP 5.3 you get a lovely series of errors along the lines of “Function ereg() is deprecated in…” and so on. This was a bit troublesome consider my development environment is XAMPP and it happens to be using version 5.3. Luckily, there’s a way to “hack” the drupal version 6.x to get it to work. Read more …

 
 

“Expires” Headers

One of those annoying little quirks you run into when checking the relative loading speed of your site. Expire headers will let your browser know if the current file is up-to-date or if it needs to be re-downloaded. If the file hasn’t changed there’s no sense in downloading the file again, thus, saving a little time in the loading of the page. This could apply to your CSS, images, movies and other media. Read more …

 
 

Adding a Static Block to your .phtml files in Magento

So I scoured the interwebs looking for this answer and finally pieced it together…so I’m saving it here for my own posterity. I found lots of results for embedding the blocks in other CMS pages but if you are working in the .phtml and .xml files then you’d have some reading to do just to get it to work.

Read more …

 
 

PHP Starter: A basic site for as little maintenance as possible.

When I got start in PHP I used this, which I got from Coldfusion (thanks Joey). It’s very basic but it’ll cut down on the number of files you have to edit as you build your first PHP sites. The idea is to break down your index page into segments that you can use in multiple instances.For example, when you decide to add a menu item you don’t have to edit all the pages of the site, just the navigation file.

Read more …

 
 

PHP cURL

This is something I use on my site for grabbing feeds from off site because of that whole “AJAX doesn’t do cross-domain requests” thing.

$cH = curl_init(); // cURL handler, initializing
curl_setopt($cH, CURLOPT_URL, $_REQUEST['url']); // URL to request
curl_setopt($cH, CURLOPT_CONNECTTIMEOUT, 2); // timeout
curl_setopt($cH, CURLOPT_RETURNTRANSFER, 1); // speeding things up
$cRet = curl_exec($cH); // storing the result, executing the cURL
curl_close($cH); // closing the cURL

if (empty($cRet)) {
  print 'Error encountered fetching the feed at ' . $_REQUEST['url']; // if not return, print error
} else {
  print $cRet;  // if there is a return, print it
}

In this case you would just pass a URL to the php file via the ‘url’ variable in the page request:

urlFetch.php?url=http://google.com