简体   繁体   English

TYPO3自定义CSS类,用于菜单链接

[英]TYPO3 Custom css class for menu links

I'm developing a new website on TYPO3 6.2 using the Bootstrap Package. 我正在使用Bootstrap软件包在TYPO3 6.2上开发一个新网站。

I want to add a custom css class to menu links via backend and print the CSS classes in my template. 我想通过后端将自定义css类添加到菜单链接,并在模板中打印CSS类。 So if I go on the Typo3 backend: 因此,如果我使用Typo3后端:

Page > Any page Properties > Appearance or Behavior Tab > Custom CSS class (I would like to have a field that I can type the classes) 页面>任何页面的属性>外观或行为选项卡> 自定义CSS类 (我希望有一个可以输入这些类的字段)

So I could type my CSS class there like " span3 orange " for Page 2 and " span4 green " for Page 3, empty for Page 1. And in my HTML I want to print that css classes like this in the menu: 因此,我可以在那里输入CSS类,例如,第2页为“ span3 orange ”,第3页为“ span4 green ”,第1页为空。在我的HTML中,我想在菜单中打印如下的CSS类:

<ul>
    <li><a href="page-1"> Page 1 </a></li>
    <li><a href="page-2" class="span3 orange"> Page 2 </a></li>
    <li><a href="page-3" class="span4 green"> Page 3 </a></li>
</ul>

How can I do that? 我怎样才能做到这一点?

  • Note 1: This is a huge website with thousands of pages, so I would be able to add classes for each page. 注意1:这是一个庞大的网站,具有数千个页面,因此我可以为每个页面添加类。
  • Note 2: Note that the menu right now is being generated via TypoScript and being called in my Fluid Template. 注2:请注意,当前菜单是通过TypoScript生成的,并在我的Fluid Template中调用。

You could also explain how to print that css classes on the body tag or on any other part of the page: 您还可以解释如何在body标签或页面的任何其他部分上打印该CSS类:

<body class="span3 orange">

You could use the page field "frontend-layout" unless you don't use it for other purposes. 您可以使用页面字段“ frontend-layout”,除非您不将其用于其他目的。 A custom field would require an own mini-extension. 自定义字段将需要自己的小扩展名。

The you write a fluid condition for the css class, whenever the other frontend layout is selected. 每当选择其他前端布局时,您都会为css类编写流畅的条件。 Location for the condition ist the template partial redering the menu. 条件的位置会导致模板部分重新显示菜单。

http://wiki.typo3.org/Fluid#f:if.2C_f:then.2C_f:else http://wiki.typo3.org/Fluid#f:if.2C_f:then.2C_f:else

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM