Sharepoint 母版页中的相对 URL

发布于 2024-08-09 07:26:33 字数 841 浏览 4 评论 0原文

我有一个带有选项卡的母版页。这些选项卡由以下站点地图文件定义:

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

友欢 2024-08-16 07:26:33

我花了几个小时寻找这个问题的答案,结果发现确实有一个,这很烦人。您可以在 WSS 站点和 MOSS 站点中使用 ProjectProperty 标记,ProjectProperty 的可能参数之一会为您提供子站点的 URL。

<SharePoint:ProjectProperty Property="Url" runat="server"/>

这会输出一个字符串文字,其中包含子网站 URL 的值。因此,例如,您可以这样做(请注意,您需要对实际 HTML 标记的 src='' 或 href='' 属性使用单引号):

<a href='<SharePoint:ProjectProperty Property="Url" runat="server"/>/pages/Tab2.aspx'>

希望它有帮助!有关 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.

<SharePoint:ProjectProperty Property="Url" runat="server"/>

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):

<a href='<SharePoint:ProjectProperty Property="Url" runat="server"/>/pages/Tab2.aspx'>

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!)

刘备忘录 2024-08-16 07:26:33

我长期以来一直在寻找执行此操作的答案...我想将我的网站打包为网站模板,并且不能使用绝对 URL...我需要它们与网站 URL 相关...无论是在 MOSS 的根部还是在结构深处的子站点...

我发现以下方法可以工作:

脚本标签:

<script type="text/javascript" src='<asp:Literal runat="server" 
               Text="<% $SPUrl:~Site/appBin/js/jquery.min.js %>" />'></script>

样式表(上面 user385947 建议的方法):

<link rel="stylesheet" type="text/css" 
       href="<% $SPUrl:~Site/appBin/css/jquery-ui.css %>" />

希望这对其他人有帮助.. 。

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:

<script type="text/javascript" src='<asp:Literal runat="server" 
               Text="<% $SPUrl:~Site/appBin/js/jquery.min.js %>" />'></script>

Style sheet (Method suggested above by user385947):

<link rel="stylesheet" type="text/css" 
       href="<% $SPUrl:~Site/appBin/css/jquery-ui.css %>" />

Hope this helps others...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文