[TYPO3-dev] Get value bits from checkbox array

David ARNOULT - Edition & Internet Operations d.arnoult at topsolid.com
Mon Jun 14 12:22:08 CEST 2010


Hi,

For once I can help someone with my newbie knowledge in php :-)
I got through this problem, personally I did not find any Typo3 function and
I used & 1/2/4/8 to test check boxes.

Example :

foreach ($varCertifications as $var) {
			if ($var['certifications'] & 1) {
				$subPartContent .=
$this->cObj->substituteMarker($CertItemTemplate, '###CERTIF###', 'cad');
			}
			if ($var['certifications'] & 2) {
				$subPartContent .=
$this->cObj->substituteMarker($CertItemTemplate, '###CERTIF###', 'cam');
			}
			if ($var['certifications'] & 4) {
				$subPartContent .=
$this->cObj->substituteMarker($CertItemTemplate, '###CERTIF###', 'mold');
			}
			if ($var['certifications'] & 8) {
				$subPartContent .=
$this->cObj->substituteMarker($CertItemTemplate, '###CERTIF###', 'wood');
			}
		}

Rgds

David
-----Message d'origine-----
De : typo3-dev-bounces at lists.typo3.org
[mailto:typo3-dev-bounces at lists.typo3.org] De la part de Stefan Frömken
Envoyé : lundi 14 juin 2010 11:49
À : typo3-dev at lists.typo3.org
Objet : [TYPO3-dev] Get value bits from checkbox array

In my extension I have 4 checkboxes in my flexform

Checkbox1 value 1
Checkbox2 value 2
Checkbox3 value 3
Checkbox4 value 4

In database I found a value of 8.

OK...I know how the binary system works. So 8 meens that my checkbox4 
was checked.

But before I programm such a converting tool on my self I want to ask 
you if there was such a function in TYPO3 included allready.

Stefan
_______________________________________________
TYPO3-dev mailing list
TYPO3-dev at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev






More information about the TYPO3-dev mailing list