TYPO3:将当前菜单页面 uid 作为参数传递给 userFunc
TYPO3: Pass current menu page uid as parameter to userFunc
如何将菜单页面 ID 传递给自定义用户函数?
我需要它以便我可以更改一些在 TYPO3 中无效的页面链接。
它们将在另一个应用程序中解析。
lib.test = HMENU
lib.test {
...
1 = TMENU
1 {
NO = 1
NO {
# do not create a link here else there are double <a> tags
doNotLinkIt = 1
stdWrap.cObject = CASE
stdWrap.cObject {
key.field = doktype
default = TEXT
default {
field = nav_title // title
typolink.parameter.field = uid
typolink.wrap = |<span><strong></strong></span>
typolink.ATagBeforeWrap = 1
stdWrap.htmlSpecialChars = 1
postUserFunc = user_productsOnCurrentPage->main
postUserFunc {
// not working
pageId.data = {page:uid}
pageId.insertData = 1
// also not working
pageId.field = uid
}
}
}
}
...
}
我可以直接在用户函数中访问页面 ID:
打字错误:
typolink.userFunc = user_mcfazabosOnCurrentPage->main
PHP:
$pageId = $this->cObj->getFieldVal( 'uid' );
This 可能有解决您问题的办法:
In TMENU $cObj->data is set to the page-record for each menu item.
因此,要传递 hmenu "current iteration" 的页面 uid,应该这样做:
postUserFunc.pageId.data = field:uid
归功于 this(德语)线程。
如何将菜单页面 ID 传递给自定义用户函数? 我需要它以便我可以更改一些在 TYPO3 中无效的页面链接。 它们将在另一个应用程序中解析。
lib.test = HMENU
lib.test {
...
1 = TMENU
1 {
NO = 1
NO {
# do not create a link here else there are double <a> tags
doNotLinkIt = 1
stdWrap.cObject = CASE
stdWrap.cObject {
key.field = doktype
default = TEXT
default {
field = nav_title // title
typolink.parameter.field = uid
typolink.wrap = |<span><strong></strong></span>
typolink.ATagBeforeWrap = 1
stdWrap.htmlSpecialChars = 1
postUserFunc = user_productsOnCurrentPage->main
postUserFunc {
// not working
pageId.data = {page:uid}
pageId.insertData = 1
// also not working
pageId.field = uid
}
}
}
}
...
}
我可以直接在用户函数中访问页面 ID:
打字错误:
typolink.userFunc = user_mcfazabosOnCurrentPage->main
PHP:
$pageId = $this->cObj->getFieldVal( 'uid' );
This 可能有解决您问题的办法:
In TMENU $cObj->data is set to the page-record for each menu item.
因此,要传递 hmenu "current iteration" 的页面 uid,应该这样做:
postUserFunc.pageId.data = field:uid
归功于 this(德语)线程。