CakePHP and JQuery

Ajax, CakePHP, JQuery

Although Prototype is the default Javascript Framework for CakePHP, using JQuery (or any other Ajax Framework) with Cake could not be easier. Perhaps the most difficult aspect of integrating JQuery with Cake was trying to find documentation on some of those little things that are necessary to return a result set without an error (see my post, CakePHP and Ajax: Missing View).

Note: I purposely wrote this post as if I were speaking to someone who has never used CakePHP. So some parts of this post may be common knowledge to the more experienced Bakers.

Continue reading

Checkout My New Site - T-shirts For Geeks

JQuery Plugin: imBannerRotater

Ajax, plugins

Note: The imBannerRotater has been replaced with gpImageRotate.
I created simple JQuery plugin that rotates images on a page. Actually, there are three modes: random, rotate, carousel, and portfolio. In the default mode, random, the plugin will display a randomly selected image. In the rotate mode, the plugin will rotate images on a page (fading in/out). In this mode, you can select the speed of the rotation. In the carousel mode, the images will move to the left in a carousel effect. I recently added a portfolio mode that using the same carousel effect, but the images are displayed differently. The image data can be retrieved ajaxally (json or a comma separated list). If the data is Json, a url can be added for each image. You can also set the image title and set whether the url will appear in a separate window (target = ‘_blank’) or in the same window (target = ‘_self’).

Continue reading

Checkout My New Site - T-shirts For Geeks

Dojo vs JQuery, Part 2: Plugins, Widgets

Ajax, Dojo, dojo-widgets, JQuery, plugins

Not long after I begin learning a new Javascript Framework, I find a need to create a plugin (or widget). I have created quite a few JQuery plugins (see previous posts) and have recently created a my 4th Dojo Widget (I have also created a few YUI widgets). I recently began working on a  JQuery photogallery plugin (I know, why re-create the wheel). I actually created this photogallery quite a few years ago, but not as a JQuery Plugin, but as a Javascript object (class). I am now converting it into a JQuery plugin.

While working on a different project (that uses Dojo), I also had to create a photogallery. While I enjoyed the benefits of using both JQuery and Dojo to re-create the photogallery, I have to say that the ability to create a template (Dojo Widgets) can significanly decrease the time it takes to create a plugin or widget.

When I initially read about Dojo widget templates, I didn’t really understand the need. My perception was that if a developer was fairly proficient with creating and manipulating DOM elements, then what is the need for a template? Well, creating this plugin using both JQuery and Dojo gave me a more favorable perception of using templates – a tremendous advantage.

Although the requirements for the JQuery photogallery plugin was a bit more complex (and although I still find it easier in general to develop using JQuery), I have to say that having the ability to create a template gives Dojo a real advantage over JQuery when creating widgets or plugins.  Advantage: Dojo.

Checkout My New Site - T-shirts For Geeks

JQuery Plugin: imList

Ajax, JQuery, plugins

imList is a JQuery plugin that began as a way to “Ajaxally” (Adjective: Meaning to post or retrieve information without having to refresh the page) create html tables using JQuery. After creating the table plugin, I realized that I could apply much of the same functionality to any type of list that is displayed on a web page, to include: ul/ol, comboboxes, lists, and divs. The power of this plugin is it’s regular expression functionality that will allow developers to display anything they wish within a list. I have also built in a delete row capability that can, not only delete the row that is displayed on the web page, but also allow the developer to delete the record from the server (ajaxally, of course).

Continue reading

Checkout My New Site - T-shirts For Geeks

JQuery Plugin: imPagePopulate

Ajax, JQuery, plugins

Depending upon the number of elements on a page, retrieving data from a database and populating a web page with the data can be a very tedious task. In the past, I have always used server-based technologies (PHP, Coldfusion, etc) to populate a page. After growing tired of creating the structures over and over again, I decided to create a JQuery plugin that would do the work for me. Most of the page population plugins I have seen only populate form elements. The imPagePopulate plugin will not only populate form elements, it will populate any HTML element on a page.

Continue reading

Checkout My New Site - T-shirts For Geeks

JQuery Plugin: imValidateForm

Ajax, JQuery, plugins

Prior to using JQuery, I had developed Javascript object that validated forms prior to submission. I got the basic concept (and some code) from the book, “Beginning Ajax with PHP: From Novice to Professional” by Lee Babin. I modified it a great deal. Once I began using JQuery, I converted the Javascript object to a JQuery plugin. Unlike most validation plugins which validate input on exit of the field (onBlur), the imValidateForm plugin validates the entire form once the user clicks the submit button. The plugin also handles the submission (, of course) and allows you to disable the submit button to prevent double-clicking.

Continue reading

Adjective: Meaning to post or retrieve information without having to refresh the page
Note: This is totally made up!! Perhaps I should add it to wikipedia or trademark the word!!

Checkout My New Site - T-shirts For Geeks

JQuery Plugin: imCheckBoxDB

Ajax, JQuery, plugins

One of my primary motivations for creating JQuery plugins is to make my life easier by enabling me to develop websites quicker. Early in my application development career (Delphi), a manager once told me, if you use a routine more than once, create a function. At the time, I had created some functions, but more often than not, I would copy/paste the same code in different places throughout the application. This revelation of creating functions was one of those “When you can pull the pebbles from my hand” moments. How interesting. What a novel idea…

There are a number of repetitive tasks that developers perform when creating web sites, especially as it relates to the gui. I was developing a web site where the owner wanted multiples lists of checkboxes on various pages of his website. On most the pages where these checkboxes appeared, the owner wanted the check boxes to have a 4-column display, but there were other pages where he wanted a 3-columns display. I got tired of copying/pasting the php/html structure from page to page, so I decided to create a JQuery plugin (imCheckBoxDB), that would layout the check box lists for me. The checkbox list is created . Both an id and label can be retrieved for each checkbox.
Continue reading

Adjective: Meaning to post or retrieve information without having to refresh the page
Note: This is totally made up!! Perhaps I should add it to wikipedia or trademark the word!!

Checkout My New Site - T-shirts For Geeks

JQuery Plugin: imUpsideDownTabber

JQuery, plugins

While designing this blog, I decided that I wanted to use tabs to display certain pages. I needed a JQuery Plugin that worked similarly to jTabber except that I wanted the tabs to display underneath the content. In addition, I wanted the relevant content to slide down (animated) when the tab was clicked. I read somewhere that I could use jTabber to accomplish this, but I thought that it would be easier if I just created the plugin myself. So I created the JQuery Plugin, imUpsideDownTabber (I couldn’t think of a better name). Click on the menu items at the top of this page (about, links, recent) to see the plugin in action.

Continue reading

Checkout My New Site - T-shirts For Geeks