【问题标题】:SharePoint Site Definition Files -- Page is always named "Home"SharePoint 网站定义文件 -- 页面始终命名为“主页”
【发布时间】:2010-11-24 10:14:10
【问题描述】:

我正在使用这种方法创建新的站点定义:

http://weblogs.asp.net/paulballard/archive/2007/04/09/creating-a-custom-sharepoint-2007-portal-site-definition-using-the-portalprovisioningprovider-class.aspx

当它们被创建时,它们并没有像我期望的那样使用站点的“标题”,而是都说“主页”。

在我的 SiteTemplates/customsite/onet.xml 文件中,我使用以下内容:

<Module Name="LifeWork" Url="$Resources:cmscore,List_Pages_UrlName;" Path="">
      <File Url="default.aspx" Type="GhostableInLibrary" Level="Draft">
        <Property Name="Title" Value="$Resources:cmscore,IPPT_HomeWelcomePage_Title;" />
        <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/LifeWork.aspx, Life &amp; Work Page Layout" />
        <Property Name="ContentType" Value="LifeWork" />
        <Property Name="PublishingAssociatedContentType" Value=";#NibrLifeWork;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900B92C2841B98136F108;#" />
      </File>
    </Module>

所以我看到它正在从资源文件中提取主页,但我认为它还应该将站点的标题附加到页面的标题中。这是正确的吗?

【问题讨论】:

    标签: sharepoint


    【解决方案1】:

    这取决于页面的设计方式。如果您查看页面 LifeWork.aspx,将会有一个内容占位符作为标题。根据您放置在那里的价值,您的页面将获得该价值。例如有几个页面有

    <SharePoint:FieldValue ID="x" FieldName="Title" .......
    

    有些网站名称附加到它。看看那个标签,你就能得到你想要的。

    【讨论】:

      【解决方案2】:

      仅供参考,我最终覆盖了 ItemCreateEventHandler :

      公共类 ItemCreateEventHandler : SPItemEventReceiver { 公共覆盖无效项添加(SPItemEventProperties 属性) { 尝试 { SPFile 文件 = properties.ListItem.File; SPWeb web = properties.OpenWeb();

                  PublishingWeb pubweb = PublishingWeb.GetPublishingWeb(web);
                  if (file.UniqueId == pubweb.DefaultPage.UniqueId)
                  {
                      if (file.Title != pubweb.Title)
                      {
                          file.CheckOut();
                          file.Item["Title"] = pubweb.Title;
                          file.Item.Update();
                          file.CheckIn("");
                      }
                  }
                  web.Dispose();
                  pubweb.Close();
              }
              catch { }
          }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-02
        • 2019-01-24
        • 1970-01-01
        相关资源
        最近更新 更多