I recently purchased the PHP Cookbook 2ed, which is by far the best PHP book for the novice user. One of the areas in PHP that I haven’t spent much time on is Database Access like getting rows from a table and binding them to an array or inserting a row and getting the new Primary key. Instead of really learning any of that I usually end up using what ever bits of code I find on the web and call it good. I have tried to read the Chapter on Databases in Programming PHP but I just can’t get into reading about database access theory and what not anymore. (I have no excuse but laziness.) Anyhow a few weeks back I was staring a new project and I need to access the database and of course the first thing I did was start digging around for some code examples I had downloaded and grab the data access code. Then I ran into a snag and decide to not be lazy so I cracked the Cookbook open to the Database section. After looking at the code examples a bit I noticed they were looking the other MySQL bits of code I’ve seen. So I flip to the beginning of the chapter and I start reading. It was the usual bla bla bla PDO bla. PDO? Oh Great. More stuff I have neglected to learn.
Read the rest of this entry »
This is something I was working on a few weeks ago.
What this demonstrates is the ability to send a block of text to a web services and have that service responds with a list of tags. Just to spice this up a bit I add in some Ajax.
Read the rest of this entry »
This hack will show you how to search Flickr using the phpFlickr class and display the results with links to a larger image and to the Flickr page.
This tip requires a bit of pre-configuration and setup which you can find here and here.
The code is very simple and those of you that have been working with the phpFlickr class this will be very easy.
Read the rest of this entry »
The title says it all and that’s just we’re going to do. We’re going to create an Ajax enabled Flickr slideshow using the phpFlickr class.
You’ll want to have a look at this article: Using phpFlickr to Intergrate Flickr Photos on Your Own Site because this hack builds off of the referenced article.
See the working example here.
Over the past couple of weeks I have been working with the phpFlickr class that interfaces with the Flickr API. Integrating with Flickr is part of a side-project that I have going which is to create a single site to display del.icio.us links, Flickr photos, Google office docs and other social networking stuff.
Any how I stumbled upon the phpFlickr class and have been hacking away at a fully integrated photo site to display my Flickr photos. Now don’t get too excited because the photos I have are mostly just my daughter (Yes, to those of you with out kids this is a little weird but I assure you it’s perfectly normal).
As always I started out with a grand plan to write the ultimate howto guide to the phpFlickr class and so far it’s going well but I am reaching a point that it’s just too much information for me to cover. So as a compromise I am posting the source code with some instructions so that others can use the code and hack at it them selves.
Read the rest of this entry »
If you want to have some cool rounded corners on your site but you don't want to go through the trouble of either creating the 4 rounded corner images then Nifty Corners is your answer.
See the search box above. I got the cool rounded corner effect with very little code.
*note - I've changed my theme again and I am not using NiftyCorners here. *
First I create the JavaScript link to the *.js file:
If you are using WordPress you will need to be sure that niftycube.js and niftycube.js are in the same directory as your template.
Next up is adding a window.onload event to the header.php and invoke the Nifty function by passing it a list of elements#id's to convert:
As you can see I am passing it a <p> tag it's respective id searchbox.
It's that easy!!
This is a quick little tip on how to pass more than one Form Element to the Ajax.Updater function in Prototype.
This came about because I wanted to do a form POST and not a GET with several Form fields but the only documentation on the internet explained how to send ONE Form field.
It's very simple but it took me a while to really get it right.
Here is a snippet:
This code is using the Ajax.Updater to send a POST to a php page with 3 form fields to be processed. As an added tip I am sending my request to a page and I am using a URL Parameter to tell that page which function to run: myparam=save_item.
Read the rest of this entry »