Recent Posts

Scaffolding with CakePHP

What is scaffolding?

Its something that you will find very useful in production apps. When you begin, you may want to throw up stuff real quick in order to get started. Ultimately, its a built in system for adding, editing, viewing and deleting your database records quickly.

Database table

Suppose we want to work with a table named users, and here is its SQL structure

  1.  
  2. CREATE TABLE `users` (
  3.   `id` bigint(20) NOT NULL AUTO_INCREMENT,
  4.   `username` varchar(50) NOT NULL,
  5.   `name` varchar(50) NOT NULL,
  6.   `email` varchar(96) NOT NULL,
  7.   `password` varchar(50) NOT NULL,
  8.   `updated` int(11) NOT NULL,
  9.   `created` int(11) NOT NULL,
  10.  PRIMARY KEY (`id`),
  11.  UNIQUE KEY `username` (`username`)
  12. )

Now lets create a controller and a model file for cakephp.

read more...
Why choose CakePHP over other PHP frameworks

Those who have the slightest experience of Ruby on Rails would understand the importance of MVC (Model View Controller) framework for developing web applications. RoR is awesome, there is no doubt at all. But as a web developer, I have to build websites for others and this means I have to use their web host. Unfortunately, there are a very few web hosts supporting Ruby (compared to PHP).

When it comes to frameworks in PHP, you would immediately think of CakePHP, CodeIgniter, Symfony or Zend Framework. Now the question is which one serves the purpose best for you.

read more...
Three column CSS layout with Blueprint framework

In one of my previous articles, I mentioned about Blueprint CSS framework. Now I am going to show you how to use it for designing your web layouts.

Before we begin, I need to tell you about its grid. Blueprint's default width for all layout is set to 950px consisting of 24 columns (width units). These columns can be controlled directly by your HTML code (divs with class attributes). You will not be required to touch your CSS files for that.

Layout (three column)
In this tutorial, we will follow a three-column layout with a header and a footer.
three-column-web-layout

read more...
CSS form design without tables

In this tutorial, I am going to show you how to simulate a table-like interface for designing a form using css. Since tables are not involved, we will require the label element for each and every field in our form.

Preview
This is what we will be designing with pure css.
css-form-design-without-tables

read more...
Load remote content into DIV element using jQuery

If you are building rich web applications, then you will obviously require some ajax to give your users a smooth browsing experience. And jQuery makes it easier for you to do that without any trouble.

In my previous articles, I have shown you how to toggle a div element and also changing its content. Now I will show you how to load content from an external file into a div element.

loadContent() function
Though most of the jQuery code is placed inside head tag, I prefer that you create an additional javascript function for managing inline anchor links quickly.

  1. function loadContent(elementSelector, sourceUrl) {
  2.   $(""+elementSelector+"").load("http://yoursite.com/"+sourceURL+"");
  3. }

This is the main jQuery code for loading remote content inside an element

  1. $("#content").load("http://yoursite.com/source.php");

Usage

  1. <a href="javascript:loadContent('#content', 'source_page.php');">Link 1</a>
  2. <div id="content">content will be loaded here</div>
read more...