why not use array?
$output = array('Rh A+', 'Rh A-','Rh B+', 'Rh B-', 'Rh AB+', 'Rh AB-');
> if (isset($output[ $patient['Patient']['bloodgroup'] ])) {
> echo $output[ $patient['Patient']['bloodgroup'] ];
> }
>
--
[email protected] <[email protected]> | Public
Key<http://pgp.mit.edu:11371/pks/lookup?search=lijunle&op=index>|
Twitter <https://twitter.com/lijunle> | SinaWeibo <http://weibo.com/lijunle>
On Wed, Apr 4, 2012 at 19:18, euromark <[email protected]> wrote:
> you can also use some kind of enum like I do:
>
> http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/
>
>
> echo Patient::bloodgroups($patient['Patient']['**bloodgroup']);
>
> anywhere in your application (in this case the view template)
>
>
> Am Mittwoch, 4. April 2012 12:14:21 UTC+2 schrieb muka:
>
>> Il 04/04/2012 11:27, alexkd ha scritto:
>> > In my patient form one blood group select box.
>> > ...
>> > Can I place a function globally to return bloodgroup when id is
>> > passed? If so what can I do for it?
>> > Thanks.
>> >
>> You can move the code in a Helper
>> book.cakephp.org/2.0/en/views/**helpers.html#creating-helpers<http://book.cakephp.org/2.0/en/views/helpers.html#creating-helpers>
>>
>> Or alter the returned data after find in the model callback, for example
>> book.cakephp.org/2.0/en/**models/callback-methods.html#**afterfind<http://book.cakephp.org/2.0/en/models/callback-methods.html#afterfind>
>>
>>
>> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php