MOSS 2007面包屑问题

时间:2008-10-27 16:03:52

标签: sharepoint sharepoint-2007 master-pages

我有一个奇怪行为的发布网站的页面布局。

想象一个发布站点(站点),其子站点(subsite1)具有以下页面(page1 [default],page2和page3)

第2页和第3页面包屑渲染正确:

site > subsite1 > page2 
site > subsite1 > page3

但是对于默认页面,面包屑仅呈现为

site > subsite1

知道如何强制它显示默认页面的标题吗?

1 个答案:

答案 0 :(得分:0)

经过多次搜索和反复失败,我决定使用AJAX包含。在任何人使用魔鬼语言(VB.Net)标记我之前我只使用它,因为我有其他开发人员使用和维护这段代码所以他们必须能够阅读它...

包括以下内容:

  1. 将当前网址拆分为其组成部分
  2. 为每个部分获取Sharepoint URL和Sharepoint Web
  3. 打印sharepoint网站的标题
  4. 如果该部分是页面,请获取页面标题并将其打印
  5. 这不是最终的代码(我今晚要重构它):

      Dim lsPage = Request.Item("CurrentPage")
      Dim TravelURL as string = "http://site/"
      Dim aryURLSections() = lsPage.Replace(TravelUrl, "").Split("/")
      Dim i as integer
    
      Response.Write("<span class='breadcrumbCurrent'>You are in &gt;</span> <span class='ms-sitemapdirectional'><a href='" & TravelUrl & "' title='Home'>Home</a> &gt; </span>")
    
      for i = 0 to (aryURLSections.Length -1)
        Dim PositionString as string = aryURLSections(i)
        if PositionString.Contains(".aspx") then
            'Render page
            Dim psite as SPSite = new SPSite(TravelUrl)
            Dim pobjSite As SPWeb = psite.OpenWeb() 
            Dim lList as SPList
            Dim lPage As SPListItem
            lList = pobjSite.Lists("Pages")
                If Not lList Is Nothing Then
                    For Each lPage In lList.Items
                    IF lsPage.ToUpper.Contains(lPage.Url.ToUpper) Then
                    Response.Write("<span class='breadcrumbCurrent' >" & lPage.Title & "</span>")
                    Else
                    'Response.Write("<br>" & lPage.Url & " " & lsPage)
                    End If
                Next
            End if
        Else if PositionString.Equals("Pages")
            ' do nothing
        else
            'render site
            TravelUrl = TravelUrl & PositionString & "/"
            'Response.Write(TravelUrl & " > ")
            Dim site as SPSite = new SPSite(TravelUrl)
    
            Dim objSite As SPWeb = site.OpenWeb()   
            Dim PubWeb = PublishingWeb.GetPublishingWeb(objSite)
    
            Response.Write("<span class='ms-sitemapdirectional'><a href='" & TravelUrl & "' title='" & PubWeb.Title & "'>" & PubWeb.Title & "</a> &gt; </span>")
        End if
    
        Next i