[TYPO3] Unique wrap based on menuitem pid

JoH asenau info at cybercraft.de
Tue Jul 10 02:17:08 CEST 2007


>> THIS_SITE.menuLeft.1 = TMENU
>> THIS_SITE.menuLeft.1 {
>>   expAll = 1
>>   IFSUB = 1
>>   IFSUB.doNotLinkIt = 1
>>   IFSUB.wrapItemAndSub = <div class="menuleft-no1"> | </div>
>>   NO.wrapItemAndSub = <div class="menuleft-no1"> | </div>
>>   }
>>
>> I ought to be able to do something like this:
>>
>> NO.wrapItemAndSub = <div class="menuleft-no1" onClick="return
>> submitForm();"> | </div>
>> NO.wrapItemAndSub.if {
>>   value = 400
>>   equals.field = the_name_of_the_variable_that_holds_the_menuitem_pid
>>   }
>>
>> and have the wrap only affect PID 400. But what is
>> "the_name_of_the_variable_that_holds_the_menuitem_pid"? And will
>> this work?
>
> I did some more experimental work with this, and discovered two
> things:
>
> 1) wrapItemAndSub doesn't seem to allow .if statements
> 2) equals.field = uid doesn't work
>
> I'm using "wrap" now, but any ideas on what other equality statements
> I could use to test the uid of the current menuitem?

Well, the problem is, that wrapItemAndSub has got no sdtWrap properties.
And you already use IFSUB so you don't have to use wrapItemAndSub for NO
anyway, since there won't be any submenus to wrap together with the item.
You could do so, but if you need stdWrap, wrapItemAndSub doesn't work.
In this case allWrap would do the job and fortunately there are stdWrap
properties available for allWrap. This means you can use allWrap.cObject and
assign a CASE element to be used as a switch.

THIS_SITE.menuLeft.1 = TMENU
THIS_SITE.menuLeft.1 {
    expAll = 1
    NO = 1
    NO {
        allWrap.cObject = CASE
        allWrap.cObject  {
            key.field = uid
            default = TEXT
            default.value = <div class="menuleft-no1">|</div>
            400 = TEXT
            400.value = <div class="menuleft-no1" onClick="return
submitForm();">|</div>
        }
    }
    IFSUB = 1
    IFSUB {
        doNotLinkIt = 1
        wrapItemAndSub = <div class="menuleft-no1">|</div>
    }
}

But IMHO it would be even better to use ATagParams and if in this case:

THIS_SITE.menuLeft.1 = TMENU
THIS_SITE.menuLeft.1 {
    expAll = 1
    NO = 1
    NO {
        wrapItemAndSub = <div class="menuleft-no1">|</div>
        ATagParams = onClick="return submitForm();"
        ATagParams.if {
            value = 400
            equals.field = uid
        }
    }
    IFSUB < .NO
    IFSUB {
        doNotLinkIt = 1
    }
}

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