TipLite Keep It Simple Smart

30Jan/120

CakePHP 1.3 helper auto-complete in netbeans

CakePHP 1.3 introduced a new way to use helpers. This was added to prevent confusion between helper variables and local variables added to the view file. You can access helper methods in a view by using $this->Helper->method(). This way make a problem if you want to use auto-complete for helpers introduced in a previous article

1Nov/110

Quick tip: Get element content within the controller in CakePHP

This is an easy quick tip to able able to get an element's content from within a controller in CakePHP 1.2 or 1.3. The trick is simple you just need an instance from View class to be able to use its element function within the controller.

30Aug/1012

CakePHP debug in NetBeans

Break point in NetBeans

Debugging code can be the most vital task a developer required to do. Debugging makes it easy to find logical errors in code. NetBeans supports PHP debug using xdebug, but in CakePHP it is hard to make this work straight. This is due to custom, pretty, URL rewriting. However you can enable debugging even with pretty URLs and URL rewriting.

12Feb/1028

CakePHP support in NetBeans

NetBeans is a very powerful development environment for many languages including PHP. With the release of its latest version, NetBeans announced full support for symfony PHP framework. NetBeans can also support many other PHP frameworks and libraries although it is not officially supported by NetBeans. This support needs some effort to enable some tools specially auto-complete, or intellisense, which saves a lot of time for developers.

We will start to make NetBeans support CakePHP. Firstly we need to create a cake project using cake command line tools.

1Dec/092

Easy HTTP Authentication using CakePHP 1.2

CakePHP 1.2 has HTTP basic authentication added to Security component which can be added to the controller using the following line in code in the following line of code

var $components = array('Security',);

To use the HTTP basic authentication you should add those lines to the action you want to restrict access:

    $this->Security->options = array('type' => 'basic', 'realm' => 'Restricted Area');
    $this->Security->loginUsers = array('user1' => 'password1', 'user2' => 'password2');
    $this->Security->requireLogin();

Realm option can be any description to the area where you want restriction. This can be any string you want. The option for 'loginUsers' is an array which the keys are user names and values are passwords.