Updating to the Latest Yii Framework

The good folks at Yii dropped their latest framework release, 1.1.9, on January 1 of this year. Updating my applications use to this new framework was comically simple thanks to a small trick: using a symbolic link to reference the framework.

Whether you're downloading Yii for the first time, or upgrading to the latest Yii framework, you can create a symbolic link in your web root directory like this:

ln -s yii-1.1.9.r3527/ yii

Also update the following webapp files and replace each reference to the hard link with a reference to the symbolic link:

  • /webapp/index.php
  • /webapp/index-test.php
  • /webapp/protected/yiic.php
  • /webapp/protected/tests/bootstrap.php

Now here's where this comes in handy: when you're ready to upgrade to a new Yii framework, simply download it and unzip it in your web root, and update the symbolic to point to the new framework. Boom, thirty seconds, you've upgraded.

(Of course it's only this easy if you haven't hacked any core framwework files. You haven't hacked any core framework files, right?)

Category:
Tags:

Making Candied Citrus Peel

Disclaimer: I'm not really into the December holidays. We had quiet Hannukah celebrations growing up and I was always turned off by Christmas displays. Probably has something to do with being raised in a mostly Jewish suburb of Cleveland, Ohio. My wife, though, had a much different upbringing (ask me about it someday). She loves the holiday traditions and embraces the season, so I've become accustomed to having both menorahs and a Christmas tree in the apartment. Slowly and begrudgingly I've found peace with all these festivities. I still cringe when the George Michael, Annie Lennox, and Mariah Carey come on the stereo, but on the other hand I do love me some Yule Log dvd.

One tradition that I can definitely get behind, though, is the exchange of holiday kitchen creations. There's nothing like Susan & Diane's exquisitely packaged cookie box, or Amorette & Elizabeth's winter homebrew and homemade bitters. As much as I'd love to just sit back and let the treats roll in, I knew I had to up the ante and create something of my own. Since I don't have years of kitchen experience like a lot of my friends, I decided to start with something simple: candied citrus peel. You can get a pleasing variety of colors, you can pack 'em up into little gift bags, and unless you really botch a step they're really hard to fuck up.

> Read More
Category:

Installing Yii Users and Rights in 5 Steps

So you've got your clean Yii installation*...now what? Frequently the next step is adding support for users and some sort of permissioning schema. The official Yii guide to Authentication and Authorization is a very comprehensive and important piece of documentation — please do take the hour or so necessary to read it and try to understand it. You could skip it, of course, and just use the following steps to get your app working, but you'd really be missing out, especially if you're new to Yii, new to object-oriented PHP, or just new to authentication/authorization methodologies.

Anyone could roll his own user and permissioning framework, but luckily there are two well-supported Yii extensions for this: yii-user and rights. Both come with installation instructions, but I'm writing it all out in steps for easy reference.

By the way, I've created a github repository with a working version of my installation. You can grab it here, or just clone it:

git clone git@github.com:benjaminlhaas/Yii-with-Users-and-Rights.git

If you use this, you'll need to run the two migration scripts in the webapp/protected/migrations directory and probably change some directory permissions. Check out the README in the root.

If you still want to install yii-users and rights step-by-step, here are the instructions:

> Read More
Category:
Tags:

Installing Yii in 10 Easy Steps

I've been working with the Yii Framework for a few months now, and have been massively impressed so far. The amount of foresight that went into the design and architecture of this framework is mind boggling, and I keep getting reminded of this over and over again when I'm trying to get a very specific task done, and I learn that a well-documented, simple method or class already exists expressly for this purpose. I'm really surprised that Yii hasn't been getting a lot of chatter in the development community (at least from the people I've been listening to).

I've thrown together a few Yii applications so far, and I thought I would document a few installation/configuration processes for my benefit, and for anyone else who stumbles across this. All of this is available in disparate locations, including the official Yii reference, but I wanted to list things out as simply as possible, detailing how I got it to work for my setup.

> Read More
Category:
Tags:

Mozilla's 4096 Character TextNode Limit

Ugh, I hate it when one browser works different than all the rest of them and displays some unexpected behavior. Believe it or not, no, I'm not talking about IE this time, it's Mozilla that's giving me a headache. Mozilla is the only major browser that imposes a 4096 character limit on TextNodes in its DOM structure.

> Read More
Category:

Flag Burner? Not Me

If you're visiting this site to learn more about the embattled would-be flag burner at LSU, I'm sorry to say that I'm not your guy, I just merely share a name with him. I support the young man's right to free speech, but the truth is I don't know enough about the facts of this case to make a statement one way or the other. I just know that I could never grow a beard as bushy or impressive as his. I haven't even been to Louisiana since that New Orleans visit way back in 1999, the one where the street psychic told me and my at-the-time girlfriend that we were destined for a happy marriage and many kids. Oops.

Brooklyn Botanic Garden, May 2011

Marci and I made our inaugural trip to the Brooklyn Botanic Garden as members this past Saturday, just in time to view the lilacs in full bloom.

> Read More

Testing out the Beer Cooler Sous Vide Hack

I've been wanting to try to replicate J. Kenji Lopez-Alt's now-famous Beer Cooker Sous Vide Hack for over a year now, and I finally had an opportunity last night. The results were impressive, if you consider that all it took was hot water from my sink (and a lot of time) to cook a steak.

> Read More
Category:

Using Apache's mod_rewrite for Maintaining Advanced and Classic Mobile Websites

These days it's not enough to just have a single mobile website. With fragmentation of handheld devices, operating systems, and browsers, your site's visitors have a wider range of a viewing capabilities than ever. My HTC Incredible for example, running Android 2.2, delivers a much richer browsing experience than my old BlackBerry Curve (you know the one - everyone used to have it in the pre-iPhone days - it's the one everyone was playing BrickBreaker on while riding the subway). To be truly considerate of your site's visitors, you should have a feature-rich "advanced" mobile site for advanced handhelds (iPhone, iPad, Android, etc.), and a simpler, more text-centric "classic" site for older handhelds. The challenge, then, is how to route users to the appropriate site without annoying them. This is where Apache's .htaccess and mod_rewrite come in handy.

> Read More
Category:

AMF and PHP with Drupal and Flex

At my company we're working on a project where we're using Drupal as an administrative-facing data storage and content management system, and Flex as a client-facing user interface. We knew conceptually that this should be an easy task, since we knew we can create and expose an API to Drupal via the Services module. We were initially concerned, though, that we might have some difficulty getting Flex to work smoothly with these API. Turns out though, that our fears were unfounded -- with the help of the AMFPHP module, it couldn't have been easier.

> Read More
Category:
Tags: , ,
Syndicate content