[TYPO3] HELP! Losing hair. Was: Can't have different NOs with different types/heights in GMENU?

JoH asenau info at cybercraft.de
Mon Oct 22 04:38:20 CEST 2007


>> With altImgResource you could use the import feature to get
>> different images depending on a condition:
>>
>> NO {
>>     altImgResource {
>>         import.cObject = COA
>>         import.cObject {
>>             10 = IMG_RESOURCE
>>             10 {
>>                 file = GIFBUILDER
>>                 file {
>>                     #blah
>>                 }
>>                 stdWrap.if {
>>                     value = 1,2,3,4,5
>>                     isInList.field = uid
>>                 }
>>             }
>>             20 = IMG_RESOURCE
>>             20 {
>>                 file = GIFBUILDER
>>                 file {
>>                     #blah
>>                 }
>>                 stdWrap.if {
>>                     value = 1,2,3,4,5
>>                     isInList.field = uid
>>                     negate = 1
>>                 }
>>             }
>>         }
>>     }
>> }
>>
>
> If I use the first method, I can't change allWrap based on the
> condition.

Of course you can, because allWrap got stdWrap properties itself, so you can
create the wrap using a cObject:

allWrap.cObject = COA
allWrap.cObject {
    10 = TEXT
    10.value = wrapA | wrapA
    10.if {
        value = 1,2,3,4,5
        isInList.field = uid
    }
    20 = TEXT
    20.value = wrapB | wrapB
    20.if {
        value = 1,2,3,4,5
        isInList.field = uid
        negate = 1
    }
}

and to do it in a more elegant way you could use a register that you can
check within both the GIFBUILDER and the allWrap:

NO {
    altImgResource {
        import.cObject = COA
        import.cObject {
            5 = LOAD_REGISTER
            5 {
                myCondition.cObject = TEXT
                myCondition.cObject {
                    value = 0
                    override = 1
                    override.if {
                        value = 1,2,3,4,5
                        isInList.field = uid
                    }
                }
            }
            10 = IMG_RESOURCE
            10 {
                file = GIFBUILDER
                file {
                    #blah
                }
                stdWrap.if {
                    isTrue.data = register:myCondition
                }
            }
            20 = IMG_RESOURCE
            20 {
                file = GIFBUILDER
                file {
                    #blah
                }
                stdWrap.if {

                    isFalse = register:myCondition
                }
            }
        }
    }
    allWrap.cObject = COA
    allWrap.cObject {
        10 = TEXT
        10.value = wrapA | wrapA
        10.if {
            isTrue.data = register:myCondition
        }
        20 = TEXT
        20.value = wrapB | wrapB
        20.if {
            isFalse.data = register:myCondition
        }
    }
}

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
openBC/Xing: http://www.cybercraft.de
T3 cookbook: http://www.typo3experts.com




More information about the TYPO3-english mailing list