在typo3 中为单页模板创建子部分菜单 [英] Create a subpart menu for a one page template in typo3

查看:27
本文介绍了在typo3 中为单页模板创建子部分菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在拼写错误 3 中集成了一个单页视差模板,我想得到一个如下所示的菜单,以便我可以在页面对象的子部分中通过单击访问特定内容.

I integrate a one page parallax template in typo 3 in this i want to get a menu like below so i can access specific content on click , in a subpart of page object.

<ul class="nav navbar-nav navbar-right">
    <li><a href="#header-section">HOME</a></li>
    <li><a href="#about-section">ABOUT</a></li>
    <li><a href="#price-section">PRICING</a></li>
    <li><a href="#contact-section">CONTACT</a></li>
    <li><a href="#contact-section">Call:&nbsp;+23-689-90  </a></li>
</ul>

推荐答案

尝试

temp.contentnav = CONTENT
temp.contentnav {
  table = tt_content
  select {
    pidInList = this
    orderBy = sorting
    where = colPos=0
    languageField=sys_language_uid

  }
  renderObj = TEXT
  renderObj {
    field = header 
    wrap=|

    typolink.parameter.field=pid
    typolink.parameter.dataWrap=|#{field:uid}
    if.isTrue.field=header
  }


}

所以你会得到一个包含所有项目的菜单.再说一次,您不会喜欢菜单项的标题取自标题字段.如果您的站点很小并且您可以对其进行控制,为什么不直接对其进行硬编码(查看源,默认情况下,每篇文章都有一个 id).

So you will get an menu of all items. Then again, you won't like that the menu item's title is taken from the header field. If your site is very small and you keep control over it, why don't you just hardcode this (look at the source, by default, each article has an id).

PS 我是从 http://www.typo3wizard 复制的.com/en/snippets/menus/content-element-navigation.html

编辑您的 TS 入门问题:

EDIT on your getting started with TS question:

在您的 HTML 模板中:

In your HTML Template:

   <html>...
   <!-- ###CONTENTNAV### START --><!-- ###CONTENTRIGHT### END -->
   ...</html>

在您的 TypoScript 设置中:

In your TypoScript setup:

page.10.subparts {
    # we fill the "subpart" (that's how this type of marker is called) with the temp object
    CONTENTNAV < temp.contentnav
}

因此,指向左侧的插入符号告诉 TYPO3,在该区域(子部分")中,它应该添加您使用 TS 代码段创建的内容菜单.

So the caret pointing left tells TYPO3 that in that region ("subpart"), it should add the content menu you've created with the TS snippet.

请注意,您也可以使用标记"(###CONTENTNAV###,不需要开始和结束评论,使用 page.10.marks 分配)和更现代的流畅模板({contentnav}),这是未来.你可以从这里开始:http://typo3buddy.com/typo3-template-tutorial/fluid/

Note that you can also use "Marks" (###CONTENTNAV###, don't need start and end commentary, assign with page.10.marks) and the more modern fluid templates (<f:format.html>{contentnav}</f:format.html>), which are the future. You could start here: http://typo3buddy.com/typo3-template-tutorial/fluid/

这篇关于在typo3 中为单页模板创建子部分菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆