Yes I've already accomplished it that way but it seems to me like a too low-level solution: CakePHP let us centralize models so I hope I could achieve the same result in the whole app. Is there no way to access the Helper classes?
On 19 Dic, 23:01, teknoid <[email protected]> wrote: > Just do that in the view... > > echo $booleanField ? 'Yes' : 'No'; > > On Dec 18, 6:27 pm, ark0n3 <[email protected]> wrote: > > > Is there absolutely no way to accomplish that? It seems to me like an > > obvious way to centralize some model-view i.e. if a Model is flagged > > "notvisibile" it seems natural to me to define afterFind() to make > > sure the boolean flag is always printed out like "Yes" and not "1". > > > Thanks > > > On 19 Dic, 00:18, teknoid <[email protected]> wrote: > > > > helpers are not meant to be used in the models, they are only to be > > > used in views. > > > > if you need something similar to what a helper method does, you could > > > just take a look at the code and re-create a method to be used in your > > > model or app model. > > > > On Dec 18, 5:05 pm, ark0n3 <[email protected]> wrote: > > > > > I'm experimenting with the method you suggested and it's great.. today > > > > I had only great problem: how to use an helper in the model? If I > > > > define the $helpers array I'm unable to use i.e. Number $number- > > > > > >currency($number, $currency)... > > > > > Thanks for your HUGE help!!! > > > > > On 12 Dic, 23:20, mark_story <[email protected]> wrote: > > > > > > Perhaps try editing the model data in afterFind(). Or changing it > > > > > before its saved in beforeSave(). Both of these methods would be in > > > > > your models. > > > > > > -Mark > > > > > > On Dec 12, 2:52 pm, ark0n3 <[email protected]> wrote: > > > > > > > Hi > > > > > > I'm sorry to bother you with some newbye question, but I'm really > > > > > > unable to find it answered on the newsgroup (it's difficult to > > > > > > explain > > > > > > and it's difficult to google it..) > > > > > > > I'm trying to improve my PHP skills using the powerful CakePHP > > > > > > framework: at the moment I'm porting an old movie-catalog > > > > > > application > > > > > > to the framework, and everything is becoming more clear as soon as > > > > > > I'm > > > > > > re-engineering every part of the old application. Also the shell > > > > > > part > > > > > > didn't was so hard, instead Cake let me do the same work with less > > > > > > code and more structural design. > > > > > > > Here's the question: > > > > > > I want to add a piece of string all the times I output a Model: i.e. > > > > > > have a Movie having two fields, 'disc' and 'comedy'. The 'comedy' > > > > > > field is boolean, and I want that every time a Movie is sent to view > > > > > > the 'disc' field is changed to C-'disc'. (I want to add a prefix to > > > > > > the disc). Is that possible? I've tried editing $this->data with > > > > > > beforeFilter and beforeRender but with no luck.. > > > > > > > Hope someone will help me! > > > > > > > Thanks > > > > > > ark0n3 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
