Archive for category Tutorials

CodeIgniter and Doctrine from scratch.
Day 11 – Record Hooks

Codeigniter Doctrine In this tutorial we will be looking into Doctrine Record Hooks. This will allow us to trigger certain actions in our Models.

We are going to use this feature to simplify a few things in the existing code, and even gain some performance benefits.

Tags: , ,

CodeIgniter and Doctrine from scratch.
Day 10 – Pagination

Codeigniter Doctrine Today we will be working on Pagination.

ci_doctrine_day10_15

CodeIgniter and Doctrine from scratch.
Day 9 – Templates & Data Hydrators

Codeigniter Doctrine In this article we are going to create Templates (with CodeIgniter) to keep our Views organized, and avoid repeating the same HTML code. Also we are going to learn about Doctrine Data Hydrators to see alternative ways to structure the data returned from the database.

ci_doctrine_day9_2

Tags: , ,

CodeIgniter and Doctrine from scratch.
Day 8 – Hooks, Profiling & DQL

Codeigniter Doctrine In this article we are going to look at 3 main subjects: Hooks (with CodeIgniter), Doctrine Profiling and DQL. And we are going to see how we can use these to optimize some of our database interactions.

Tags: , ,

Top 20+ MySQL Best Practices

preview Nettuts+ just published my article!

http://net.tutsplus.com/tutorials/other/top-20-mysql-best-practices/

Database operations often tend to be the main bottleneck for most web applications today. It’s not only the DBA’s (database administrators) that have to worry about these performance issues. We as programmers need to do our part by structuring tables properly, writing optimized queries and better code. Here are some MySQL optimization techniques for programmers.

Read more

Tags:

CodeIgniter and Doctrine from scratch
Day 7 – Fixtures & Forum List

Codeigniter Doctrine Today we will continue building our Message Board project. First we will start building the Home Page, which will be a Forum List. Then we will learn about Doctrine Data Fixtures. This will help us create some test data to play with.

ci_doctrine_day7_4

Tags: , ,

CodeIgniter and Doctrine from scratch
Day 6 – Models with Relationships

Codeigniter Doctrine In this episode of the series, we will continue building our Message Board project. First we will have a quick overview of Doctrine Model Relationships. Then we will create Models for our Message Board, such as: Forums, Threads, Posts etc… with proper relationships. Finally we will learn how to add data into such Models.

Tags: , ,

CodeIgniter and Doctrine from scratch
Day 5 – Database CRUD

Codeigniter Doctrine CRUD stands for Create, Read, Update and Delete, the basic operations performed on the database. With regular CodeIgniter setups, most developers would use the Active Record Class for performing such operations. But we are not going to be doing that.

In this episode of the series, I will show you how to perform CRUD with Doctrine.

Tags: , ,

CodeIgniter and Doctrine from scratch
Day 4 – User Login

Codeigniter DoctrineIn this episode we are going to build a User Signup Form following these steps:

- We build a Login Form View and a Login Controller.
- Learn about some URL Helpers.
- Change the Default Controller.
- Implement User Authentication.
- Learn about Singleton Pattern and use it to improve our code design.
- Learn about the Sessions Library.
- Implement User Logout.

ci_doctrine_day4_1

Tags: , ,

CodeIgniter and Doctrine from scratch
Day 3 – User Signup Form

codeigniter_doctrineIn this episode we are going to build a User Signup Form following these steps:

- We build a “User” Model with Doctrine.
- Learn about Mutators.
- Create tables using Doctrine.
- Remove index.php from CodeIgniter urls
- Build and Style the Signup Form.
- Learn about Helpers, Libraries and how to extend them.
- Form Validation and checking for duplicates.

ci_doctrine_day3_3

Tags: , ,

CodeIgniter and Doctrine from scratch
Day 2 – The Basics

codeigniter_doctrineIn this episode:

- We do a quick fresh install of CodeIgniter and Doctrine, without going into details like last episode.
- Briefly go over some of the basic concepts of CodeIgniter and Doctrine.
- First we will review Controllers and Views in CodeIgniter.
- Then we will move on to Models using Doctrine. This is where things are going to get a little different, compared to other CodeIgniter tutorials out there.
- Finally we will preview a sample Doctrine Model and talk about what our main project is going to be.

Tags: , ,

PHP Method Chaining, plus Magic Setters
(similar to jQuery)

php-method-chaining-1

Quick Disclaimer: Even if you know about PHP5 Method Chaining, don’t skip this article, because we will explore more than just that.

If you’re familiar with jQuery, you might know how it let’s you write short and clean code with the help of method chaining.

Not only will I show you how to accomplish this in PHP5, but I will also combine this feature with magic setter methods with the help of method overloading to make it even nicer.

It’s OK if you don’t know any of these terms. You should still be able to become familiarized with them by reading this article.

Tags: , ,

CodeIgniter and Doctrine from scratch
Day 1 – Install and Setup

codeigniter_doctrineBeing inspired by the wonderful series of articles/screencasts on the nettuts website called CodeIgniter From Scratch I decided to write my own series on using CodeIgniter and Doctrine together to build a functional website in a series of tutorials.

In this first part of series, I will show you how to create a basic CodeIgniter install and add Doctrine as a plug-in.

Tags: ,

GeoIP country lookup with PHP

geoip_iconHow to get the surfers country using PHP? Most coders need to tackle this problem sooner or later. There are several options out there. There is even a package called GeoIP Location. However, since this does not come with most default installations, it may not be your best choice.

A company called Maxmind specializes in professional GeoIP solutions. However, when you dig through their website, you can find that they also provide some free databases and free code. I will show you how to use this free stuff in a portable way to easily and quickly add an Ip to Country lookup feature to your PHP script in 2 easy steps.

Tags: ,