Ajax and Ajax Frameworks

I have been a developer for nearly 20 years and a web developer for about 10 years. Over the years, I have considered creating a blog to share the things I have learned (and am learning) about web design and development, but I never seemed to have the time. When I began learning about web development using Ajax and Ajax Frameworks, I decided to take the time to create this blog.

My intention for this blog is to focus primarily on Ajax Frameworks, but since web development requires knowledge of many technologies, I will occasionally write about things such as CSS, Javascript, PHP, MySQL, Flash, etc.

Lately, I have been using JQuery as my primary Ajax tool. Although I have used other Ajax Frameworks in the past (Dojo Toolkit, Yahoo! User Interface Library, Scriptaculous/Prototype), JQuery has thus far been the easiest to learn. In my first few posts I will discuss some of the JQuery Plugins that I have created. Some of these include: a plugin for Google Maps (jquery.imGoogleMaps), Form validation and submission  (jquery.imValidateForm), Page Populater (jquery.imPagePopulate), and a plugin to create lists (jquery.imList).

While I am still learning about some of the other Ajax Frameworks, I hope that what I have learned will be helpful to others. Just remember, “When you can pull the pebbles from my hand…”

Posts Tagged ‘CakePHP’

I purchased the domain name digitalvilliage.com quite a few years ago. I wasn’t sure what I was going to do with it when I first purchased the name (but I knew that it was a great domain name). Although I still haven’t decided what the focus of the site should be, I decided, for now, to create a web 2.0 domain name generator on the site. I developed the site using CakePHP and jQuery. I created a JQuery plugin to provide the domain names ajaxally (a term that I added to wikipedia – and yes, I already purchased the domain name) .

The site divided into two subdomains (web20.digitalvilliage.com and galleries.digitalvilliage.com). I’ll discuss the galleries subdomain in a later post.

I’ve seen other web 2.0 domain name generators, but my site offers more than just web 2.0 domain name generation. The site contains two main buttons (web 2.0 and suggest)

Click the web 2.0 button and a domain name will be dynamically generated.

I you click the suggest button, a dialog box will be displayed with a name input field and a category dropdown. The categories are: automotive, art, books, business, clothing, computers/internet, entertainment, health/fitness, money/finance, music, politics, popular, romance, travel, and urban dictionary.

After entering a name and selecting a category, a list of domain names will be displayed. You can then click on the name and click the search button to find whether the name is available. If you click on a name from the ‘urban dictionary’ category, a popup will be displayed with the definition from urbandictionary.com. I’ve only added 40-50 names from urbandictionary.com – I plan to add more later.

After entering a name from the suggest or clicking the web 2.0 button, you can then search for the availability of the name.

If a domain name exists, the Google Page Rank, Alexa Rank, Google, Yahoo, and Bing BackLinks counts will be displayed. You will also be provided a link to the whois database for that name as well a link to Alexa Stats.

If the domain name does not exist, you will be provided a link to a number of domain name registrars.

I worked on this site on-and-off for about 6 months (whenever I had the time). I think that it’s pretty cool. The site provides an Ajax web 2.0 domain search generator and an Ajax domain search tool. Let me know what you think.

Share

As a developer, I hate writing similar code for the same process over and over again. Just like highly optimized database design, developers should always try to write code as efficiently as possible.

I’m working on a project where I use YUI and CakePHP to fill multiple combo boxes on a page using Json data. At first, I wrote separate code with the same functionality for each combo box. Every time I needed to change the functionality, I had to change it for each combo box. After doing this multiple times, I decided to combine the functionality on both the front-end (YUI) and the back-end (CakePHP).

Read the rest of this entry »

Share

I’ve been upgrading an Intranet application that I created for a client. I created the front-end using YUI (Yahoo! User Interface Library) and I am working on migrating the back-end to CakePHP. After setting up CakePHP, my first step of integrating YUI with CakePHP is retrieving data ajaxally. The application was already using YAHOO.util.Connect to retrieve the data, but I had to change my parsing code due to the format of the Json data that is returned by CakePHP.

Read the rest of this entry »

Share

I justed received an error when logging into a CakePHP app. It was the Auth Component error:

you are not authorized to access that location

It occurred when I attempted to create two session variables:

if ($loggedIn == 1) {
	$result = $this->User->findByUsername($this->Auth->user("username"));
	if ($result) {
		$this->Session->write('User.langID', $result['User']['language_id']);
		$this->Session->write('User.cntryID', $result['User']['country_id']);
		echo '{"type":"continue"}';
	}
}

Because one generally receives this error message when attempting to access a page that is secured by the Auth Component and ACL, I thought that the session component was attempting to write to a restricted area. After a bit of testing, I realized that the User session var (User.langID) was being used by the Auth Component. So I changed User to an application specific variable:

$this->Session->write('rdsStaff.langID', $result['User']['language_id']);
$this->Session->write('rdsStaff.cntryID', $result['User']['country_id']);

No more errors. I hope this will be useful to someone in the same situation.

Share

Viewing CakePHP’s .ctp files in Aptana Studio has been quite annoying due to the lack of syntax highlighting. I have grown use to it until earlier today when I was converting a .php file into a .ctp. I knew there had to be a way to associate .ctp files with .php files in Aptana/Eclipse. I did a bit of searching and found the solution.

  1. Go to Window/Preferences/General
  2. Select Content Types
  3. In the right pane, select the Text Navigation tree
  4. Select PHP Content Type
  5. Click the Add button
  6. Enter *.ctp and click Ok

If you have a .ctp file open, you will have to close and re-open it to view the changes. Much better.

Share

In my last post, I discussed the YUI imYUILogin widget that I created. In this post, I will demonstrate how to log in ajaxally using the imYUILogin widget with CakePHP and the AuthComponent. I’m assuming that you have already read the Simple ACL Controlled Application and have the AuthComponent configured correctly. I’m also assuming that you are familiar with the Yahoo User Interface Library.

Read the rest of this entry »

Share

I have been upgrading an web application for a client. I initially created the application using a custom php framework – spliced together however awkwardly, but it worked. In version 2, I included YUI 2.8, but have been using the same backend.

The site is nearly complete (ajax functionality, and database development), I decided that I needed a more structured php framework. I chose CakePHP primarily because I could bake the models, views, and controllers. With only 17 tables, The application is not very large, but the thought of creating models, views, and controllers for 17 tables did not sound exciting.

I could not bake on my Mac. I got an error, “Call to undefined function mysql_connect()”. I searched for hours trying to figure out why I was receiving the error, but to no avail. I think that I need to re-install PHP. Not going to happen. I instead decided to setup Cake on my Ubuntu box (See my post: Setting Ubuntu For Web Development).

Read the rest of this entry »

Share

I started back on a CakePHP intranet application that I haven’t worked on in a while. I received a ‘Missing Database Table’ error when I viewed the application in a browser. The table that was mentioned in the error had been deleted a few months ago and I no longer had a model, view or controller for this table. After a few hours of investigating, I found that I had to delete the cache files (app/tmp/cache) that were created when I initially baked this table.

Share

After installing CakePHP on my Ubuntu box, I viewed the default home page in my browser and noticed that the page was not styled. Cake did not know the path to the CSS file because I had not enabled mod_rewrite. Although I could opt to setup CakePHP to work without mod_rewrite, I decided to enable it.

Read the rest of this entry »

Share

I recently started converting an existing PHP project to CakePHP and YUI 2.8. The first decision that I had to make was where to place the YUI CSS files. I tried to find a quick, yet elegant solution, but I ended up with solution that was not so quick (or elegant).

I copied all of my YUI files from webroot/js/yui/ to webroot/css/yui/. I then opened each folder under webroot/css/yui/ and removed all of the js files (leaving the assets folder). If a folder contained js files only, then I deleted the folder.

I opened each folder under webroot/js/yui/ and removed all asset folders and css files. If a folder contained css files only, then I deleted the folder.

I spent about an hour trying to find another solution, so I guess the few minutes it took to remove the files/folders was worth it.

Share