SharePoint站点定义文件 - 页面始终命名为“Home”

时间:2009-08-31 18:13:03

标签: sharepoint

我正在使用此方法创建新的网站定义:

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>

所以我看到它从资源文件中拉回家,但我认为它还应该将网站标题附加到页面标题中。这是对的吗?

2 个答案:

答案 0 :(得分:1)

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

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

有些网站名称附加了它。看看那个标签就可以得到你想要的东西。

答案 1 :(得分:0)

仅供参考我覆盖了ItemCreateEventHandler:

public class ItemCreateEventHandler:SPItemEventReceiver     {         public override void ItemAdded(SPItemEventProperties properties)         {             尝试             {                 SPFile file = 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 { }
    }
}