能否为Typo3面包屑添加stdWrap.data?日期前置实现疑问
Hey there! Let's fix that breadcrumb issue you're having. The problem with your current code is that you're using stdWrap.data directly on the HMENU, which replaces the entire menu output with the date—so your breadcrumb links get wiped out entirely.
Instead, we need to combine the date and the breadcrumb menu as separate elements, using a COA (Content Object Array) to stitch them together. Here's a working solution:
20 = COA 20 { # Wrap the entire breadcrumb + date in a <p> tag (adjust as needed) wrap = <p>|</p> # 1. Output the current date first 10 = TEXT 10 { data = date : d.m.Y # Add the separator after the date to connect to the breadcrumb wrap = | > } # 2. Output your rootline breadcrumb menu 20 = HMENU 20 { special = rootline special.range = 0 | -1 1 = TMENU 1 { NO = 1 # Add separator between breadcrumb items NO.allWrap = | > # Style for the current page (remove the trailing separator) CUR = 1 CUR.allWrap = | } } }
Key Notes:
- COA Usage: The COA lets us chain multiple content objects together—first the date text, then the breadcrumb menu. This ensures both elements render without overriding each other.
- Date Handling: The
TEXTobject withdata = date : d.m.Ysafely pulls the current date, and we add the separator ( > ) viawrapto match your desired format. - Breadcrumb Cleanup: We set
CUR.allWrap = |to remove the trailing arrow from the current page, so your breadcrumb won't end with an extra>.
If you need to adjust the date format (e.g., Y-m-d instead of d.m.Y), just modify the date : d.m.Y part to your preferred format string.
内容的提问来源于stack exchange,提问作者Hans Martin
相关产品推荐
相关产品推荐

