FrontPress: Users, Meta, and an Installer

It’s now simple to add users, an installer, and meta to your FrontPress-powered application. Plus, FrontPress won’t query as aggressively, so you’ll save on database queries per page.

As an added bonus, FrontPress takes care of all of your database upgrades. Simply change the database version number whenever you change the schema, and FrontPress will automatically do upgrades for you.

Meta can be enabled with one line of code in any FP_Thing subclass:

static $__has_meta = true;

FP_User combines the simplicity of FP_Thing and the extensibility of BP_User. Want to know if the current user is logged in or if they have a certain capability or if they like bananas?

FP_User::can( 'do-whatever' );
FP_User::get_meta( 'likes_bananas' );

What are you waiting for? Get developing!

First Ever FrontPress Site

FrontPress Site - Home


I’ve been asked whether FrontPress was being designed for frontends, for example, if it was a template system. The answer is a definite yes: Your template code creates a frontend, but FrontPress turns your code itself into a frontend as well. The code I showed in my last post could be fully understood at a glance. My_Fruit::by_color retrieves fruit based on its color. $apple->save(); stores data about an apple in the database.

FrontPress Site - Yellow


My incredible amount of appreciation for my own system aside, it is possible to make an entire website from FrontPress. The site is pointless, but it shows the power of FrontPress and a few lines of code. The site is live on my home website, and you can download the source code if you want to see how exactly it works.

FrontPress Site - Yellow Apples

Yellow Apples

Breadcrumbs are my favorite part of this demo. The breadcrumb for the yellow apple page is generated completely by FrontPress. The only code inside the route – routes are how FrontPress’s template system chooses which page to display – related to the breadcrumb is frontpress_breadcrumb( $fruit );. My_Fruit implements two interfaces by way of three one line functions. My_Color implements a single interface by way of two one line functions.

FrontPress is still far from its first official release. I plan to add an easy way to build an installer, some example templates, and maybe more before then.



require_once dirname( __FILE__ ) . '/load.php';

// Non-programmers start reading here
$green_apple = My::$fruit->one_by_color_and_type( 'green', 'apple' );

echo '<h1>', $green_apple->color->name, ' apples are called "',
     $green_apple->name, '".</h1>';

If you don’t know how to program, try reading this code. You can read it, right? That’s because the code is written using my newest project, FrontPress. Now, if you do know how to program, you may be wondering how My::$fruit is defined. Here’s the entire definition of My::$fruit:


class My_Fruit extends FP_Thing {
    var $__table = 'fruit';

    var $id;
    var $name;
    var $color;
    var $type;
My::$fruit = new My_Fruit;

Now, you’re probably interested. The class has no functions and only one variable with a value. This is why FrontPress is so awesome. If you want to delete all the yellow fruit from your database, that’s one line of code:

My::$fruit->by_color( 'yellow' )->delete();

Or, maybe you just want to reclassify all yellow fruit as lemons:

My::$fruit->by_color( 'yellow' )->set( 'type', 'lemon' )->save();

You can also do so in three commands:

$yellow_fruit = My::$fruit->by_color( 'yellow' );
$yellow_fruit->type = 'lemon';

What if there’s some new color of apple you’ve never heard of?

$c0ffee = new My_Color( array( 'name' => 'C0FFEE', 'slug' => 'c0ffee',
                               'hex' => 'c0ffee' ) );
$c0ffee_apple = new My_Fruit( array( 'name' => 'C0FFEE Apple',
                                     'color' => $c0ffee,
                                     'type' => 'apple' ) );

And it’s smart, too:

$lemon = My::$fruit->by_type( 'lemon' );

This code won’t even attempt to save it once because no changes are made to the object.

Want to try it? Break it? Change it? Go right ahead. This is GPL software, after all! 🙂

Announcing Android Shuffle

Have you ever wanted to call someone, but didn’t know who to call?

Is typing a seven digit phone number and clicking the call button too mentally taxing for you to accomplish?

Have you noticed that these sentences keep getting progressively longer until they reach the maximum limit for sentence length, which is right about here?


Then why the heck are you still reading this post?

Oh, sorry! I thought you said no! What you really said was “I love you, Ben!”

That’s right, folks! Today, we at the LlamaSlayers™ © ® LLC,,. have invented an amazing new technology known as “Android Soufflé” or some other crappy name like that.

LlamaSlayers™ © ® LLC,,. Large Button Pushing Technology Software ProgramA cutting-art, state-of-the-edge technology known as “LlamaSlayers™ © ® LLC,,. Large Button Pushing Technology Software Program”, or “LlamaSlayers™ © ® LLC,,. Large Button Pushing Technology Software Program” for short, ensures that your experience is as smooth as possible. Here is a diagram of how it works:

Android Shuffle

Amazing, huh? Download the LlamaSlayers™ © ® LLC,,. Large Button Pushing Technology Software Program-based software program called Android Shuffle from our web site or send an email to the following address and we’ll fax you a copy of this amazing software program!

LlamaSlayers™ © ® LLC,,.
Tsinghua Science Park Bldg 6
No. 1 Zhongguancun East Road
Haidian District
Beijing 100084

The power of WebM

A little while ago, a friend of mine gave me a 3½ inch floppy and told me that it contained a 1080p video.

I was skeptical at first, wondering if it was even possible to fit a video on a 1.44MB device, let alone a 1080p video.

I opened the video, and I found what was supposed to be 10 seconds of 30 fps 1080p Theora, but what turned out to be more like 3 seconds because VLC thought reading a 30 fps file as 90 fps would be cool.

Then I realized that I had already done something similar – remember “Close your eyes and watch this”? I downloaded it from YouTube, converted it to WebM, and compressed it with 7-zip, and I ended up with a file that was 271KB. Then I tried with audio and got an 11MB 7-zip file.

You can download the WebM version (22MB when uncompressed) here. With audio (33MB when uncompressed).

The best part is that I can compress it even further using other open formats, like PNG, seeing as the video is a single frame for 10 minutes.

…But the 10 minutes of 1080p fitting into 271KB is what WebM should really be used for.

Complete waste of time

Have you ever been sitting, staring at a wall (or computer screen), and wondering what the heck you should do with your life?

Enter Complete waste of time: A new web app brought to you by LlamaSlayers.

Now, you can sit and stare at a computer screen and watch the cool designs fly past you. And here’s the best part: You can see the total time you and others have wasted together!

Unfortunately for you Internet Explorer people, this app doesn’t work on your so-called web browser. Fortunately for you, your choice of web browsers causes your entire life to be a waste, so you can just use your age instead of this fancy-pants online internet computer software program.

If the animation is lagging for you, try making your browser window smaller.

Have fun!