Beginners' Guide Category

PHP Basics: Accessing Remote URLs using cURL

Friday, June 19th, 2009

In this post, I’m going back to basics to talk about accessing remote URLs with cURL.

In PHP, there are actually four ways to access a remote URL - fope n() fsockopen(), cURL extensions and HTTP_Request class from the PEAR library. Now, choosing one way over another really depends on your needs for simplicity, control, and portability.
(more…)

PHP’s alternative syntax and why it’s useful

Thursday, April 16th, 2009

PHP offers an alternative way to write their control structures for as long as I’ve remembered. It basically does away with the curly brackets and replaces the opening curly with a colon (:) and the closing with ‘end’-whatever. I have to be honest and say I’ve never really found a need to use the alternative syntax, simply because I’m so used to using the curly braces after so many years of using PHP. Plus, it’s less typing!

But having spend time working on CodeIgniter projects, I have found myself adopting this alternative syntax when it comes to buidling the CI’s views templates. I appreciate that there is place in the PHP universe for this alternative coding style.

(more…)

CodeIgniter: Extending the native ‘Model’ and make it your own.

Friday, November 7th, 2008

Today I took advantage of CodeIgniter’s ability to extend the native libraries, and I was well satisfied that it just works.

Let me elaborate, I’m in the process of creating models for my CI project, and realized that certain functions within the models were getting repetitive. Using CI’s ability to create my own custom libraries, I was able to create my own custom ‘Model’ which extends from the core ‘Model’ object. How this simple architecture has cleaned up my code is simply remarkable.

So read on…
(more…)

CodeIgniter: Organizing views simply

Wednesday, October 22nd, 2008

Having been brought up developing PHP using templating systems like Smarty, I’m very used to segmenting my page elements into reusable block, and swapping out blocks of HTML codes, nesting blocks of code within other blocks and so on.

Trying my hands at using CodeIgniter, one of the first obstacles I had was how to organize my ‘blocks’ on a page. Without knowing any better, I thought I had to reiterate the same view calls in every function within the controller, making the controller codes very messy.

It turns out that CodeIgniter allows us to nest views within views, and that has made things a lot simplier for me.

(more…)

CakePHP: Baking in frustration

Tuesday, June 10th, 2008

CakePHP Frustration Sometime back, I posted about my first experience with CakePHP. I installed the framework and went through the tutorial on building a simple blog application, and said “I was quite impressed”.

Now, after 3+ development weeks trying to build a real-world application, I think, maybe I was too hasty to draw that conclusion.

(more…)

PHP or .NET? Help me to choose!

Wednesday, May 7th, 2008

We’ve all encountered it before, and we’ve all asked this question in one way or another. I see it appearing in Yahoo Answers every now and then, and I see similar platform comparison in blogs I read. Its clear this issue is still quite relevant today and will continue to be tomorrow.

So which is better? PHP or .NET?

(more…)

First look at CakePHP

Monday, May 5th, 2008

CakePHPFinally, I found some time to take CakePHP for a spin. I’ve heard some really good things about it, and I’ve been trying to get some time to try it out. I installed the framework and went through the tutorial on building a simple blog application. I have to say I’m quite impressed.

(more…)

Writing your first PHP script

Tuesday, January 15th, 2008

Now that you know how to use XAMPP Lite, it’s time to write your first PHP script.

This tutorial will guide you on writing your first PHP script, show you how the PHP syntax is used, and where to put and run your PHP pages in XAMPP.

Note: this tutorial assumes you are using XAMPP Lite environment for your PHP scripts. If you want to setup your own XAMPP Lite environment, follow this tutorial about installing XAMPP Lite on a portable device.

(more…)

Using XAMPP Lite for PHP scripting

Tuesday, January 8th, 2008

Now that you know how to setup your XAMPP Lite, it’s time to find your way around XAMPP Lite, and get ready for your first PHP script.

This post will highlight some of the features available in XAMPP, and what you do with them. It’s just a simple overview, so don’t expect anything in detail. Those will follow in later posts.

(more…)

Installing XAMPP Lite on a Portable Storage device

Thursday, January 3rd, 2008

One of the fastest and best way to get a PHP server environment up and going is to use XAMPP. What is XAMPP you say?

Put together by the folks at Apache Friends, XAMPP is an installer package containing the Apache Web Server, MySQL, PHP and Perl. XAMPP takes away the hassle and headache of installing and configuring each of the parts individually. But best of all – It FREE!

(more…)

Google