Yeah it says *outside*.
Inside the view layer you don't use CakeNumber, you use the helper Number:
$this->Number->...()
which, of course, internally wraps the CakeNumber functionality.
Am Dienstag, 23. Dezember 2014 13:05:12 UTC+1 schrieb LDSign:
>
> Just one question in addition. The cookbook says
>
> If you need NumberHelper
> <http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper>
> functionalities
> outside of a View, use the CakeNumber class:
>
> Whats the point using "CakeNumber::" inside of views instead of
> $this->Number? Is this just a style quqstion or has it any drawbacks?
>
> Thanks,
> Frank
>
> Am Montag, 22. Dezember 2014 16:06:23 UTC+1 schrieb LDSign:
>>
>> Hi
>>
>> Ive a function which converts a number to currency value (e.g. 10 ->
>> 10,00 EUR).
>>
>> So far I have a custom "TextHelper" with that method within (becuase its
>> view related).
>>
>> The problem is, now I need this (exactly same) method in a controller
>> (for generating a flash message). Of course I could place this as a simple
>> function in bootstrap.php (and use it in both, controller and view), but as
>> far as I remember this is bad practice. Bad practice too is to clone this
>> functionality in a component for DRY reasons.
>>
>> So whats the best practice for such a case?
>>
>> Thanks,
>> Frank
>>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.