Wednesday, July 28, 2010

php- Cakephp how to load helper in a component

Helpers can be loaded in to components and use as class objects

function index() {
App::import('Helper', 'Html'); // loadHelper('Html'); in CakePHP 1.1.x.x
$html = new HtmlHelper();
debug($html->link('Cake!', 'http://cakephp.org'));
}

Thursday, July 15, 2010

Php - creating table of values with fixed column from an array of values

Easily create tables

Use array_chunk($arrvalues, 2);

Array
(
[0] => Array
(
[0] => a
[1] => b
)

[1] => Array
(
[0] => c
[1] => d
)

[2] => Array
(
[0] => e
)

)


http://www.php.net/manual/en/function.array-chunk.php