Free PHP List Files in a Directory Script

Posted: March 19th, 2010 | No Comments

After finding a bunch of ugly scripts to display files in a directory, I finally created my own. It’s two simple files: index.php and icons.png. (might switch to .gif soon)  Grab the files at the address below and beautify your file listings.

Get it now at: http://www.halgatewood.com/free/file-directory-list/

I’ve also added a ‘freebies’ section to the lower right of the sidebar —–>
Check it out.

Read more »


Saturday Night Live Graphs

Posted: March 18th, 2010 | No Comments

A few numbers have been crunched and here are the results:


Enable WebShop Tab in eZ Publish 4.3 admin

Posted: March 18th, 2010 | No Comments

A release candidate for eZ Publish 4.3 was posted the other day.  One of the new defaults is less tabs in the top navigation. Here is how you can bring back the tabs.

Navigate to the setup tab across the top:

Read more »


How I Met Your Mother

Posted: March 18th, 2010 | No Comments


Highlight Unicode Text in PHP

Posted: March 18th, 2010 | No Comments

I was trying to get my old highlight function to highlight Russian text from a MySQL database. No Go. It was using eregi_replace which is deprecated according to the php manual. I ended up getting this to work:

function highlight($word, $block)
{
  $pattern = '/('. quotemeta($word) .')/ui';
  return preg_replace($pattern, '<span class="highlight">$1</span>' , $block );
}

That’s it. I use it to highlight the searched words on khristos.org like this:

<?php
$q = $_GET['q'];
foreach($results as $result)
{
  echo highlight($q, $result);
}
?>

In the pattern line you will see a ‘/ui’ at the end. The u stands for Unicode and the i stands for case-insensitive.

Hope this helps.