Forums / Developer / How to interpret common boolean value representations?

How to interpret common boolean value representations?

Author Message

Piotrek Karaś

Sunday 16 December 2007 3:49:39 am

Hello,

Is there any universal function/method within eZ libraries for interpretation of different representations of boolean values? One that would take a value, for example: 'false', 'disabled', '0', false, 0... and simply return false, etc...

Easy to write, but I don't want to reinvent it. Also, maybe it's a wrong approach, since configuration params may be very context-dependent.

I'd be grateful for any hints!

Thanks,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Kristof Coomans

Sunday 16 December 2007 2:08:20 pm

Hi Piotrek

There doesn't seem to be a direct translation of the empty() PHP function. However, you can easily add empty() to eZ Publish: http://ezpedia.org/wiki/en/ez/phpoperatorlist. Good luck ;)

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Piotrek Karaś

Sunday 16 December 2007 2:51:43 pm

Hey Kristof,

Thanks for the reply. I wasn't actually only thinking about detecting empty values, but those, too. If I ever get across what's in my mind, I'll let you know ;)

Meanwhile, quite an interesting thing about PHPOperatorList as well as Wrap operator, even though at this point of my work I don't see a need or will to move too much programming to the presentation/template layer. Still, I will give it a closer look.

Thanks for interesting tip!

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu