[TYPO3-core] RFC#14538: Icons missing in page tree for "Page contains" pages

Steffen Ritter info at rs-websystems.de
Sun Jun 13 09:23:46 CEST 2010


Am 13.06.2010 00:03, schrieb Steffen Kamper:
> Hi,
>
> +1 by reading except last lines
>
> + krsort($recordType, SORT_NUMERIC);
>
> i think wrong decision for a numeric array and the purpose. Qute from
> doc: "This is useful mainly for associative arrays. "
> I suggest:
> $recordType = array_reverse($recordType);
>
>
> + while ($iconName === '' && (list($key, $icon) = each($recordType))) {
> + $iconName = (in_array($icon,
> $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable']) ? $icon : '');
> + }
>
> list inside while looks bad designed, also readability isn't good. i
> suggest:
> foreach ($recordType as $key => $icon) {
> if (in_array($icon,
> $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
> $iconName = $icon;
> break;
> }
> }
>
> vg Steffen
>
Hey Steffen,
sorting ok, this I will change,
the Loop, might be discussable. I know that we try to get rid of 
while/each combination. But to me It's real bad design, quitting loops 
via break; It's nearly like GOTO 20...

Therefore I build a loop which has it's ending condition where it should 
be: loop's header

We also could do:
+ while ($iconName === '' && next($recordType)) {
+ $icon = current($recordType);
+ $iconName = (in_array($icon, 
$GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable']) ? $icon : '');
+ }

which really would be readable, since it's almost literally

But that's discussable, since the cgl says nothing about quitting loops 
via breaks don't know how to handle ;)

Probably a third opinion should be taken ...

reagrds


More information about the TYPO3-team-core mailing list