dongyi2993 2015-02-02 15:51
浏览 45
已采纳

extbase扩展 - 如何更新面包屑

I created an extension with extbase which displays different content dependning on the GET parameters. Is there a way to update the breadcrumbs to reflect this?

My breadcrumbs look like this in typoscript:

temp.breadcrumb = HMENU
temp.breadcrumb {
    special = rootline
    special.range = 0|-1
    1 = TMENU
        1 {
        noBlur = 1
        wrap = <ol class="breadcrumb hidden-xs">|</ol>
        NO {
            stdWrap.crop = 26 | ...
            wrapItemAndSub = <li>|</li>||<li>|</li>||<li class="last">|</li>
            ATagTitle.field = abstract // title // description
            ATagTitle.noTrimWrap = | zur Seite: |
        }
        CUR = 1
        CUR {
            stdWrap.crop = 26 | ...
            wrapItemAndSub = <li class="active">|</li>||<li class="active">|</li>||<li class="last active">|</li>
            doNotLinkIt = 1
        }
    }
}

page.10.variables {
  breadcrumb < temp.breadcrumb
}

and in my template I call them like this:

<f:format.raw>{breadcrumb}</f:format.raw>

So they work fine on normal pages, but not for my extension scripts.

  • 写回答

1条回答 默认 最新

  • dqayok7935 2015-02-03 13:58
    关注

    This is a breadcrumb navigation I did a while ago which incorporates news detail views, but you'll get an idea of how to incorporate your own tables. Please note that there is some additional markup, as it follows the Google Rich Snippet Microformat for breadcrumbs.

    lib.navi.breadcrumbs = COA
    lib.navi.breadcrumbs {
    stdWrap.wrap = <ul class="breadcrumb ">|</ul>
    
    10 = TEXT
    10 {
        value = Your Homepage
        typolink {
            parameter = 1
            ATagParams =  itemprop="url"
            ATagBeforeWrap=1
            wrap = <span itemprop="title">|</span>
        }
        wrap = <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">|<span class="divider">/</span></li>
    }
    20 = HMENU
    20 {
        special = rootline
        special.range = 1|-1
    
        1 = TMENU
        1 {
            noBlur = 1
    
            NO = 1
            NO {
                wrapItemAndSub = <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">|<span class="divider">/</span></li>
                ATagParams = itemprop="url"
                stdWrap.htmlSpecialChars = 1
                stdWrap.wrap = <span itemprop="title">|</span>
            }
    
            CUR <.NO
            CUR {
                wrapItemAndSub = <li class="active">|</li>
                doNotLinkIt = 1
                stdWrap.wrap >
            }
        }
    }
    
    # Add new if on single view
    40 = RECORDS
    40 {
        if.isTrue.data = GP:tx_news_pi1|news > 0
        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 class="active">|</li>
    }
    }
    
    [globalVar = GP:tx_news_pi1|news > 0]
    lib.navi.breadcrumbs.20.1.CUR {
    wrapItemAndSub = <li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">|<span class="divider">/</span></li>
        doNotLinkIt >
    }
    [global]
    

    It basically creates a menu and appends the news title at the end if a news uid is given (lib.navi.breadcrumbs.40).

    The condition condition afterwards changes the behaviour on the last 'real' page from HMENU to act as a normal breadcrumb link.

    You can then integrate the code in your FLUID template via:

    <f:cObject typoscriptObjectPath="lib.navi.breadcrumbs" />
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?