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: Mixing segment-based URL with querystrings

Monday, March 9th, 2009

Codeigniter, by default crafts it’s URL in a search engine friendly format. It uses a segment-based approach and does away with the all familiar querystring format that developers have been using for many years to pass parameters via the URL into their applications.

Codeigniter does allow you to turn on the querystring capability, but that would mean you have to use a pure querystring approach, foregoing the segment-based approached.

So, is it possible to mix segments and querystring?
(more…)

Review: Professional Codeigniter

Friday, February 13th, 2009

Professional CodeIgniterThere are currently only two books published about Codeigniter available in the market, one is called CodeIgniter for Rapid PHP Application Development and the other is this one I’m reviewing.

Having being using Codeigniter for a few simple projects, and really consider myself a CI newbie, I scooped up this book when I saw in at my local library, hoping for more insights into this wonderful framework. Instead I was left disappointed.

(more…)

Codeigniter: Helpers, Plugins and Libraries

Wednesday, December 3rd, 2008

Codeigniter JigsawHaving used Codeigniter for a few months now, this framework is really turning out to be a joy. My last post, I talked about how to modify native CI Libraries.

With so many published PHP classes and functions, it would be a shame if we couldn’t use them in CI. Fortunately CI (like all good frameworks) provides not one but three ways to integrate 3rd code, by using Helpers, Plugins and Libraries.

(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…)

Google