Currently Browsing: CakePHP Snippets
Jan 8, 2009
Did you know? String::insert is nice for translation!
You probably replace your language strings like so: e(sprintf( __("Please %s or %s to write a comment", true), $html->link(__("login", true), array('controller' => 'users', 'action' => 'login')), $html->link(__("register", true), array('controller' => 'users', 'action' => 'register')) )); There are two problems with it: You may have to explain alot when someone translates the app. %s is... read more
Jan 2, 2009
How to use THIS in THAT and then some
Some common questions on IRC: How to use a model in a component $model = ClassRegistry::init('ModelName'); $result = $model->find('...'); How to extend a core helper App::import('Helper', 'Text'); class AppTextHelper extends TextHelper { // ... your code } How to extend a core component App::import('Component', 'Auth'); class AppAuthComponent extends AuthComponent { // ... your code } How to get... read more

