Sharepoint 母版页中的相对 URL
我有一个带有选项卡的母版页。这些选项卡由以下站点地图文件定义:
<siteMap>
<siteMapNode title="Home" url="~/" >
<siteMapNode title="Schedule" url="~/Pages/Tab2.aspx"/>
<siteMapNode title="Deliverables" url="~/Pages/Tab3.aspx"/>
<siteMapNode title="My Items" url="~/Pages/Tab4.aspx"/>
<siteMapNode title="Management" url="~/Pages/Tab5.aspx"/>
<siteMapNode title="Working Docs" url="~/Pages/Tab6.aspx"/>
</siteMapNode>
</siteMap>
问题是,在我的子站点上,单击选项卡会不断将我带回根目录。例如,我希望计划链接转到 http://Server/Subsite/Pages/Tab2.aspx 。相反,我得到的是 http://Server/Pages/Tab2.aspx。我读到在链接开头添加波浪号可以解决这个问题,但事实并非如此。
I have a master page with tabs. The tabs are defined by the following sitemap file:
<siteMap>
<siteMapNode title="Home" url="~/" >
<siteMapNode title="Schedule" url="~/Pages/Tab2.aspx"/>
<siteMapNode title="Deliverables" url="~/Pages/Tab3.aspx"/>
<siteMapNode title="My Items" url="~/Pages/Tab4.aspx"/>
<siteMapNode title="Management" url="~/Pages/Tab5.aspx"/>
<siteMapNode title="Working Docs" url="~/Pages/Tab6.aspx"/>
</siteMapNode>
</siteMap>
The problem is that on my subsites, clicking on a tab keeps taking me back to the root. For example, I want the schedule link to go to http://Server/Subsite/Pages/Tab2.aspx. Instead, what I am getting is http://Server/Pages/Tab2.aspx. I read that having a tilde at the beginning of the link would solve this problem but it doesn't.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我花了几个小时寻找这个问题的答案,结果发现确实有一个,这很烦人。您可以在 WSS 站点和 MOSS 站点中使用 ProjectProperty 标记,ProjectProperty 的可能参数之一会为您提供子站点的 URL。
这会输出一个字符串文字,其中包含子网站 URL 的值。因此,例如,您可以这样做(请注意,您需要对实际 HTML 标记的 src='' 或 href='' 属性使用单引号):
希望它有帮助!有关 ProjectProperty 其他可能值的列表,请查看 此人的页面(这是我找到原始答案的地方!)
I spent HOURS looking for the answer to this question, and it turns out there IS one, it's just annoying. You can use the ProjectProperty tag in WSS sites AND MOSS sites, and one of the possible parameters for ProjectProperty gives you the subsite's URL.
That outputs a string literal with the value of the subsite URL. So, for example, you can do this (note that you need to use single-quotes for the src='' or href='' attribute of the actual HTML tag):
Hope it helps! For a listing of other possible values for ProjectProperty, check out this guy's page (which is where i found my original answer!)
我长期以来一直在寻找执行此操作的答案...我想将我的网站打包为网站模板,并且不能使用绝对 URL...我需要它们与网站 URL 相关...无论是在 MOSS 的根部还是在结构深处的子站点...
我发现以下方法可以工作:
脚本标签:
样式表(上面 user385947 建议的方法):
希望这对其他人有帮助.. 。
I was looking for an answer to do this for a long time... I want to package my site as a Site Template and having absolute URLs was not an option... I need them to be relative to what ever the site URL is... whether it is at the root of MOSS or a sub-site deep down in the structure...
I found the following to work:
Script Tags:
Style sheet (Method suggested above by user385947):
Hope this helps others...
您正在寻找 ~site 令牌,这里是自定义 URL 令牌的列表到WSS。
You're looking for the ~site token, here's a list of the URL tokens custom to WSS.