How to set breadcrumb for tx_news TYPO3

℡╲_俬逩灬. 提交于 2019-11-30 20:21:44

问题


I have a TYPO3 site. I need to set a breadcrumb. For news I need to show the news title inplace of 'News Detail' (Page title of news plugin). How to implement that?

My code is

<v:page.breadCrumb class="breadcrumb" levels="1" showCurrent="1" divider=">" showCurrent="1" entryLevel="1"/>

or any other method for getting the title like

<ol class="breadcrumb">
  <li><a href="/">Home</a></li>
  <li><a href="/news">News</a></li>
  <li class="active"> ???????? </li>
</ol>

回答1:


Sorry but that is not possible out of the box. The news record is not a real page and therefore must be added a bit different.

Instead of using the viewhelper, use this TS code

lib.navigation_breadcrumb = COA
lib.navigation_breadcrumb {
stdWrap.wrap = <ol class="breadcrumb">|</ol>

10 = HMENU
10 {
    special = rootline
    #special.range =  1

    1 = TMENU
    1 {
        noBlur = 1

        NO = 1
        NO {
            wrapItemAndSub = <li>|</li>
            ATagTitle.field = subtitle // title
            stdWrap.htmlSpecialChars = 1
        }

        CUR <.NO
        CUR {
            wrapItemAndSub = <li class="active">|</li>
            doNotLinkIt = 1
        }
    }
}

# Add news title if on single view
20 = RECORDS
20 {
    if.isTrue.data = GP:tx_news_pi1|news
    dontCheckPid = 1
    tables = tx_news_domain_model_news
    source.data = GP:tx_news_pi1|news
    source.intval = 1
    conf.tx_news_domain_model_news = TEXT
    conf.tx_news_domain_model_news {
        field = title
        htmlSpecialChars = 1
    }
    wrap =  <li>|</li>
}
}

And include it by using <f:cObject typoscriptObjectPath="lib.navigation_breadcrumb" />



来源:https://stackoverflow.com/questions/38872462/how-to-set-breadcrumb-for-tx-news-typo3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!