简体   繁体   English

Typo3 BootStrap 3导航栏(打字稿)

[英]Typo3 BootStrap 3 navbar (typoscript)

Hi I am new to typoscript and I need help in getting the menu working. 嗨,我是打字错误的新手,我需要帮助来使菜单正常工作。 The following typoscript will render the Bootstrap navbar, yet the menu is thrown out of the navbar completely without css styles. 以下打字稿将呈现Bootstrap导航栏,但菜单完全不使用CSS样式而被抛出导航栏。

 topnavigation = HMENU topnavigation.wrap ( <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="http://www.example.com">Brand</a></div> <div class="collapse navbar-collapse" id="navbar-collapse"> <ul class="nav navbar-nav"> </ul> </div> </div> </nav> ) topnavigation.entryLevel = 0 topnavigation { 1= TMENU 1 { expAll = 1 maxItems = 4 NO.wrapItemAndSub = <li>|</li> ACT = 1 ACT.wrapItemAndSub = <li class="active">|</li> IFSUB = 1 IFSUB.wrapItemAndSub = <li class="dropdown">|</li> ACTIFSUB = 1 ACTIFSUB.wrapItemAndSub= <li class="active dropdown">|</li> } 2= TMENU 2 { wrap = <ul class="dropdown-menu">|</ul> NO.wrapItemAndSub = <li>|</li> ACT = 1 ACT.wrapItemAndSub = <li class="active">|</li> } } 

Please help 请帮忙

You haven't pipe symbol in your topnavigation.wrap anywhere... 您没有在topnavigation.wrap管道符号。将其topnavigation.wrap在任何地方...

Each wrap should use pipe symbol | 每个包装应使用管道符号| in the place where the wrapped content should be placed, as ie in your TMENU: 在应该放置包装内容的地方,例如在您的TMENU中:

NO.wrapItemAndSub = <li>|</li>

Anyway your general wrap with this whole Bootstrap markup doesn't have it, most probably that's the reason of wrong rendering... 无论如何,使用整个Bootstrap标记进行的常规包装都没有,这很可能是渲染错误的原因...

Most probably it should be somewhere there: 最有可能应该在那里:

   ...
      <ul class="nav navbar-nav">|</ul>
   ...

BTW, use browser's inspector tools to check what's missing, we can only guess. 顺便说一句,使用浏览器的检查器工具检查缺少的内容,我们只能猜测。

Biesior, thanks for pipe suggestions, it did set me in the right direction. Biesior,感谢管道的建议,这确实使我朝着正确的方向前进。 After a load of research and hacking (not being a coder and alien to typoscript), I managed to get the bootstrap 3 inverse navbar working correctly with in typo3. 经过大量的研究和黑客攻击(不是编码员,也不是打字错误),我设法使bootstrap 3反向导航栏在typo3中正常工作。

The following code works out of the box. 以下代码可以直接使用。

 topnavigation = HMENU topnavigation.wrap ( <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="http://www.example.com">Your Company Name or Logo</a> </div> <div class="collapse navbar-collapse" id="navbar-collapse"> <ul class="nav navbar-nav">|</ul> </div><!-- /.navbar-collapse --> </div><!-- /.container --> </nav> ) topnavigation.entryLevel = 0 topnavigation { 1 = TMENU 1 { expAll = 1 NO.allWrap = <li>|</li> NO.ATagTitle.field = abstract // description // title ACT = 1 ACT.wrapItemAndSub = <li class="active">|</li> ACT.ATagTitle.field = abstract // description // title IFSUB = 1 IFSUB.before = <a href="#" class="dropdown-toggle" data-toggle="dropdown"> IFSUB.after = <b class="caret"></b></a> IFSUB.doNotLinkIt = 1 IFSUB.wrapItemAndSub = <li class="dropdown">|</li> IFSUB.ATagTitle.field = abstract // description // title ACTIFSUB = 1 ACTIFSUB.before = <a href="#" class="dropdown-toggle" data-toggle="dropdown"> ACTIFSUB.after = <b class="caret"></b></a> ACTIFSUB.doNotLinkIt = 1 ACTIFSUB.wrapItemAndSub = <li class="dropdown active">|</li> ACTIFSUB.ATagTitle.field = abstract // description // title } 2 = TMENU 2 { expAll = 1 ACT = 1 ACT.wrapItemAndSub = <li class="active">|</li> ACT.ATagTitle.field = abstract // description // title ACTIFSUB = 1 ACTIFSUB.wrapItemAndSub = | ACTIFSUB.before = <li class="divider"></li><li class="nav-header"> ACTIFSUB.after = </li> ACTIFSUB.doNotLinkIt = 1 ACTIFSUB.ATagTitle.field = abstract // description // title NO.allWrap = <li>|</li> NO.ATagTitle.field = abstract // description // title IFSUB = 1 IFSUB.before = <li class="divider"></li><li class="nav-header"> IFSUB.after = </li> IFSUB.doNotLinkIt = 1 IFSUB.ATagTitle.field = abstract // description // title SPC = 1 SPC.allWrap = <li class="divider"></li><li class="nav-header">|</li> wrap = <ul class="dropdown-menu">|</ul> } 3 = TMENU 3 { NO.allWrap = <li>|</li> NO.ATagTitle.field = abstract // description // title ACT = 1 ACT.wrapItemAndSub = <li class="active">|</li> ACT.ATagTitle.field = abstract // description // title } } 

Remember to refer to the extension in the main page (fileadmin/your_template/layouts/your_main_page.html) 记住要参考主页中的扩展名(fileadmin / your_template / layouts / your_main_page.html)

<f:cObject typoscriptObjectPath="topnavigation" />

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

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