Memcache with Codeigniter
In one of my latest projects we are using memcache to store user data and other items that will improve user experience. The cache library i am using is one i found on the CI forms. The library offers two types of caching. One is file caching for static pages or static data like a query. Two is memcache much faster and for data that is needed on quickly, note that memcache is not intended for static page caching you will need to use file caching for that.
How to use this library.
Load the library.
$this->load->library('Cache');
Now, useMemcache
$this->cache->useMemcache(MEMCACHE_IP, MEMCACHE_PORT);
After that we can now save data to memcahce.
$data = array('name' => 'Greg', id => 190); $this->cache->save($data["id"].'_user',$data,NULL,3600); // --------- // $this->cache->save(KEY, DATA, GROUP, TTL);
If you plan on using file caching you do not need the “useMemcache()” file caching is on by default. But if you want to use both you can just call “useFile()” to switch back to files. Example below:
$this->cache->useMemcache(MEMCACHE_IP, MEMCACHE_PORT); $data = array('name' => 'Greg', id => 190); $this->cache->save($data["id"].'_user',$data,NULL,3600); // Data above saved to memcache $this->cache->useFile(); $data = array('name' => 'Greg', id => 190); $this->cache->save($data["id"].'_user',$data,NULL,3600); // Data above saved to file.
Now lets retrieve the data from the cache.
$this->cache->get(KEY); // In my case above... $user = $this->cache->get('190_user'); echo $user->id; // would be 190
Download Cache.php library for Codeigniter.
Polyphonic Spree on Blastoff
Now available for Blastoff Network Members only is the new Polyphonic Spree album! Here is a screen shot of the new page splitter going above the site header, again ONLY for members!
Blastoff Network goes live to the public on November 2nd 2009 so keep your eye out! Blastoff Network

Blastoff on PizzaHut.com
Launched today is the new Pizza Hut Blastoff Network campaign! Pizza hut will be running advertisements on both the web and in print. The main campaign is the pizza box toppers, so the next time you order Pizza Hut look for Blastoff Network!

Pizzahut.com
If you have not seen Blastoff Network yet this is the time to get into it! Visit Blastoff Network.
Blastoff Network Invites!
The company I work for “Blastoff Network” is launching a huge feature on 10/22/09. This will allow Blastoff members to invites friends and family to their network. Below is a few screen shots from the invite system!


Some details from Invites
Inviting friends, family, colleagues, and other acquaintances to join an online network has never been so rewarding. Blastoff can automatically send your existing contacts an invitation on your behalf. Soon they will be enjoying all of the benefits of Blastoff membership while saving money on every purchase. As your network grows, so will your rewards.
Blastoff is written in Cake PHP, with a partner that is running ASP classic. So some of the programming is a challenge to make it all sync up, but i work with a great team that makes it happen. I am happy to be a part of the Blastoff Network development team.
Wordboxes.com
This is a new project i am working on with a few friends. I have had this domain for some time but never had time to use it.
What do you do with a box?
Boxes are used for many things. We use them to stack, to move, and to store. But what if there was box that did more?.
What would you do if you had a box like that? Tell a friend where you have been with a picture, get that thought of your mind, or just let the world know how you feel. Wordboxes will revolutionize the way you communicate with one another.Whether it will be with a picture,a few words, or both. Wordboxes will be the one box you won’t want to be without!
I will post more details about this project soon, but the best way to find out more is to “Get Notified” at Wordboxes.com.
No launch date has been set for this project, but the target is December 2009.
Welcome to the future
A thorn in the side of many web developers is Internet Explorer 6. It’s an old browser that has many annoyances that cause those creating websites to have to add additional code just to have things render as they should. Google, being a company that develops a web browser, has taken it upon themselves to solve this problem somewhat. It has just released an early version of a project called Google Chrome Frame, which, when used, will cause Internet Explorers 6 through 8 to use Chrome’s rendering engine, not their default one. This allows stubborn users (or those in a workplace environment) to continue using the browser they want to, and no longer aggravate web developers.
Read more about Google’s Chrome Frame
Thanks Google!
CodeIgniter v1.7.2 Cart Class
As you make know I am a huge fan of CI and this update has been long over due! The cart class is something that really makes me happy as a developer. I no longer have to look to a shopping cart that only meets half my needs. I can now build and deploy one with ease!
The Cart Class permits items to be added to a session that stays active while a user is browsing your site. These items can be retrieved and displayed in a standard “shopping cart” format, allowing the user to update the quantity or remove items from the cart.
Please note that the Cart Class ONLY provides the core “cart” functionality. It does not provide shipping, credit card authorization, or other processing components.
Load the cart lib and start using!
$this->load->library('cart');
Adding an Item to The Cart
$data = array( 'id' => 'sku_123ABC', 'qty' => 1, 'price' => 39.95, 'name' => 'T-Shirt', 'options' => array('Size' => 'L', 'Color' => 'Red') ); $this->cart->insert($data);
Destroy the cart
$this->cart->destroy();
More info on this can be found in the users guide on the CI website.
Winn Guestbook 2.4.7
The latest version of the popular guest book, added some major bug fixes and new features. One of the new items is you can now view posts on the guest book in there own page by calling “http://yourDomain/post.php?p=[id]“, this is pre linked for you now next to the persons name.
The web install is now working correctly with no errors. To download the latest version hop on over to the Google project page and click download.
Basics of Codeigniter
Lets go over some basics of CI, we all know it’s a great php framework with a small learning curve. I am going to show you some session basics.
To use sessions make sure you have that in your auto load array. Then we can start using the session markup.
So for this example i want to add some user data that i have pulled from the database into the session. Below is how i will add custom session data.
1 2 3 4 5 6 | $SesArray = array( 'firstname' => $db_fname, 'lastname' => $db_lname ); $this->session->set_userdata($SesArray); |
Now lets say i want to retreve this data and display it. Below is how to recall this custom session data.
1 | echo $this->session->userdata('firstname'); |
The above code would display the ‘firstname’ var that was stored in the session.
Now lets remove the ‘firstname’.
1 | $this->session->unset_userdata('firstname'); |
Once that is removed from the session you will be unable to recall that again, so be sure you wish to unset it.
FlickrHelper
A simple script i had been working on for the Vetteblock project, that allows me to fetch photos from Flickr and display them in a list view. The project could not use php on the main server but could run JavaScript, so i needed to make an http request to the php script “FlickrHelper” and pull in the images.
FlickrHelper uses jQuery and php to make it all work along with a great script called phpFlickr.
Checkout the project page, and download the latest version on FlickrHelper!
Categories
Pages
- contact
- Contact Form V1.8
- FlickrHelper
- Guestbook V1.01 ASP
- Guestbook V2.4.7
- iFrame Loader
- Scriptatype:PHP
- Winn Cal
- Winn Tracker
