[英]Generate a typolink with nav_title instead of title as link text
How can I configure TYPO3 7.6 / 8.7 to use nav_title instead/before title on generating page links with fluid_styled_content? 在生成带有fluid_styled_content的页面链接的标题时,如何配置TYPO3 7.6 / 8.7使用nav_title代替/在标题之前?
Currently I'm using 目前我正在使用
<f:link.typolink parameter="7"></f:link.typolink>
in my fluid template. 在我的流体模板中。 ( https://fluidtypo3.org/viewhelpers/vhs/master/Link/TypolinkViewHelper.html ) ( https://fluidtypo3.org/viewhelpers/vhs/master/Link/TypolinkViewHelper.html )
This generates me a translated page link using the page.title field. 这会使用page.title字段为我生成翻译后的页面链接。 I need to output the page.nav_title field there. 我需要在那里输出page.nav_title字段。
With css_styled_content (instead of fluid_styled_content) I could access/output the value in TS like 使用css_styled_content(而不是fluid_styled_content),我可以像访问TS中那样输出/输出值
temp.field_title = TEXT
temp.field_title.value = nav_title // title
(This was working similar in HMENU / TMENU ...) (这在HMENU / TMENU中工作类似...)
This is intended behavior of the typolink function. 这是Typolink函数的预期行为。 The Fluid typolink
viewhelper uses stdWrap to generate the link for a given content. Fluid typolink
viewhelper使用stdWrap生成给定内容的链接。 If you do not provide any content to be "typolinked", then the typolink will always render the title of a given page uid as a fallback. 如果您不提供任何要进行“打字链接”的内容,则错字链接将始终将给定页面uid的标题呈现为后备。
Pure TypoScript example with no content: 没有内容的纯TypoScript示例:
temp.field_title = TEXT
temp.field_title.typolink.parameter = 7
This example will render the page title of page uid 7, since no content for the TEXT
is given. 由于未提供TEXT
内容,因此本示例将呈现页面uid 7的页面标题。
In order to render the nav_title as content of the typolink viewhelper, I suggest to use the page.info
viewhelper from the vhs extension. 为了将nav_title呈现为typolink viewhelper的内容,我建议使用vhs扩展中的page.info
viewhelper。
Example: 例:
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<f:link.typolink parameter="7">
<v:page.info pageUid="7" field="nav_title"/>
</f:link.typolink>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.