我有一个奇怪行为的发布网站的页面布局。
想象一个发布站点(站点),其子站点(subsite1)具有以下页面(page1 [default],page2和page3)
第2页和第3页面包屑渲染正确:
site > subsite1 > page2
site > subsite1 > page3
但是对于默认页面,面包屑仅呈现为
site > subsite1
知道如何强制它显示默认页面的标题吗?
答案 0 :(得分:0)
经过多次搜索和反复失败,我决定使用AJAX包含。在任何人使用魔鬼语言(VB.Net)标记我之前我只使用它,因为我有其他开发人员使用和维护这段代码所以他们必须能够阅读它...
包括以下内容:
这不是最终的代码(我今晚要重构它):
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 ></span> <span class='ms-sitemapdirectional'><a href='" & TravelUrl & "' title='Home'>Home</a> > </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> > </span>")
End if
Next i