[TYPO3] Challenge: render IAProcFunc menus differently based on returned record content
Peter
typo3 at peter-b.org
Sun Oct 7 13:32:09 CEST 2007
Ok, here's the simple bit:
lib.myMenu = HMENU
lib.myMenu {
1 = GMENU
1 {
itemArrayProcFunc = tx_myext_myplugin->getMenuRecords
NO = 1
NO {
ATagTitle.field = title
allWrap = <span class="navItem"> | </span>
backColor = #999999
XY = 100,20
10 = TEXT
10 {
text.field = title
fontColor = #ffffff
}
}
}
}
This works perfectly, produces the result you would expect, a menu based
on the array returned by getMenuRecords.
The challenge:
The array returned by getMenuRecords contains rows from a plugin table
rather than page records. In addition to the useful and required
'title', 'uid' etc, one of the fields returned in each record in the
array is labeled 'myfield'.
What I need is for NO to be different based on the field 'myfield':
NO {
ATagTitle.field = title
allWrap = <span class="navItem"> | </span>
backColor = #eeeeee
XY = 200,40
10 = TEXT
10 {
text.field = title
fontColor = #333333
}
}
[] can't be used inside lib.myMenu.1, and is useless outside as
'myfield' is out of scope.
NO = CASE can't be used or I can't determine a way to use it for this
purpose - the contained parameters are always ignored resulting in a
blank white image of default size
Despite much wrangling I can't see how I can work an IF statement into
the GMENU so that the entire NO entry is different based on the content
of the 'myfield' field.
I could, potentially, get away with making the differences exist only
inside lib.myMenu.1.NO.10 but still can't see how I can use CASE or IF
to do this.
Any ideas anyone?
Peter.
More information about the TYPO3-english
mailing list