TypoScript: {field:uid} replacement not working |

2019-05-19 00:48发布

I have a header menu and try to define different CSS classes for each item.

This is what I have:

20 = HMENU
  20 {
    special = directory
    special.value = 107
    1 = TMENU
    1 {
      wrap = <ul class="foo" id="mymenu">|</ul>
      expAll = 1
      NO = 1
      NO.allWrap = <li class="first menu_{field:uid}">|</li> || <li class="menu_{field:uid}">|</li> || <li class="last menu_{field:uid}">|</li>
    }
  }

But in the HTML output I simply get class="first menu_{field:uid}" and nothing is replaced.

By the way: The page entries in the menu are links to external pages.

EDIT:

As our designer complained about the non-speaking class IDs we are abusing the body-class attribute now:

  NO.allWrap = <li class="first {field:bodyclass_wrap_class}">|</li> || <li class="{field:bodyclass_wrap_class}">|</li> || <li class="last {field:bodyclass_wrap_class}">|</li>      

1条回答
女痞
2楼-- · 2019-05-19 01:09

You have to add NO.allWrap.insertData = 1, then the data will be inserted. allWrap is just a normal stdWrap, so the default features apply there.

BTW: I think your option split is still wrong. I guess you want to have it like this:

NO.allWrap = <li class="first menu_{field:uid}">|</li> |*| <li class="menu_{field:uid}">|</li> |*| <li class="last menu_{field:uid}">|</li>
查看更多
登录 后发表回答