mengetuk keyboard untuk mencari sesuap nasi

Archive for the 'CakePHP' Category


CakePHP: Ternary condition

Kalau selalu guna if and else, langkah seterusnya mesti tahu ternary condition. ade alternative lain nak guna dalam CakePHP, contoh: /* ife in cakePHP */ ife($condition, $true, $false) jadi, kalau statement ternary tu cam ni: /* ternary condition */ echo ($x)?’x = true’:'x = false’; ble ubah jadi macma ni. mudah sket /* replace ternary [...]

CakePHP: Kenapa layout masih tak tukar?

Kalau malas asik nak declare layout di cakephp, aku akan guna code macam ni. /* before Render */ function beforeRender() { parent::beforeRender(); $this->layout = ‘plugin’; …. } lepas tu aku nak tukar stail layout, misalnya nak guna layout “ajax”. jadi aku declare macam ni.. /* children */ function children($id = null) { …. $this->layout = [...]