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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 20:56:30
Script start
Timing: Jan 18 2025 20:56:30
Module start 'layout'
Timing: Jan 18 2025 20:56:30
Module start 'content'
Timing: Jan 18 2025 20:56:31
Module end 'content'
Timing: Jan 18 2025 20:56:31
Script end

Main resources:

Total runtime1.3705 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 589.2578152.6406
Module start 'layout' 0.00800.0027 741.898439.4766
Module start 'content' 0.01071.3581 781.3750545.5156
Module end 'content' 1.36880.0016 1,326.890612.1250
Script end 1.3704  1,339.0156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.2906160.0002
Check MTime0.00160.1164160.0001
Mysql Total
Database connection0.00150.110210.0015
Mysqli_queries1.310495.6194570.0230
Looping result0.00050.0384550.0000
Template Total1.333397.320.6666
Template load0.00220.158520.0011
Template processing1.331197.126820.6655
Template load and register function0.00010.009610.0001
states
state_id_array0.00160.114410.0016
state_identifier_array0.00400.291020.0020
Override
Cache load0.00180.1293200.0001
Sytem overhead
Fetch class attribute can translate value0.00070.053820.0004
Fetch class attribute name0.00130.091850.0003
XML
Image XML parsing0.00110.076920.0005
class_abstraction
Instantiating content class attribute0.00000.000960.0000
General
dbfile0.00110.0797230.0000
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs