There are several reasons you might want to know where one TextFormat ends and another begins. If your application supports any HTML authoring, you’ll likely need something like this, even if your HTML support is fairly basic. I’ve been working on a font loading management utility, so I needed something to detect which portions of […]

Continue Reading

mod_rewrite trouble

 May, 04 - 2009   no comments   Uncategorized

I’m going to keep my eyes open for an actual explanation for this behavior, but I thought I’d share a problem (and solution?) I ran into with mod_rewrite. I was going about my business, doing the classic mapping of http://mydomain/subdir/var1/var2 to http://mydomain/subdir/index.php?id=var1&id=var2 I had two rules, one to handle a single variable, and another to […]

Continue Reading

Smarty File Size Modifier

 May, 02 - 2009   4 comments   How To

Here’s a simple Smarty modifier that will format an integer that represents the number of bytes in a file as a human readable string. Usage: {$fileSizeInBytes|file_size} Example: {assign var=fileSizeInBytes value=10485760} {$fileSizeInBytes|file_size} {assign var=fileSizeInBytes value= 768000} {$fileSizeInBytes|file_size} {assign var=fileSizeInBytes value=303} {$fileSizeInBytes|file_size} Output: 10 MB 750 Kb 303 bytes <?php /** * Smarty plugin * @package Smarty […]

Continue Reading