我可以使用多个母版页更上一个SharePoint网站? [英] Can I use more than one master page on a sharepoint site?

查看:144
本文介绍了我可以使用多个母版页更上一个SharePoint网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求修改主页全新的设计,所有的其他页面将保持完全一致。

I have been asked to modify a home page to a completely new design, all other pages will remain exactly the same.

我有点绿色的,当涉及到SharePoint。我创建了母版,但是当我选择 设置为默认母版页 设置为客户母版它改变整个站点。我只想更改主页。

I am a little green when it comes to sharepoint. I have created the masterpage, however when i choose set as default master page or set as customer masterpage it changes for the entire site. I would only like to change the home page.

我也碰到过在这一点上唯一的选择似乎是的分离从页面布局这将不理想的网站的其余部分可被推入这种新的皮肤

The only option I have come across at this point would seem to be Detach from page layout which would not be ideal as the remainder of the site may be pushed into this new skin

推荐答案

编程为改变这个特定页面的母版是奈杰尔说是唯一的选择。

Programmatically changing the masterpage for this particular page is the only option as nigel says.

您可以创建主页自定义的页面布局,然后将母版上pre-初始化,如下所示:

You can create a custom page layout for the homepage and then set the masterpage on the pre-init as shown below:

public class MyPageLayout:PublishingLayoutPage 
{ 
    protected override void OnPreInit(EventArgs e) 
    { 
        base.OnPreInit(e); 
        this.MasterPageFile = "~/_catalogs/masterpage/mynewmasterpage.master";                    
    } 
} 

这篇关于我可以使用多个母版页更上一个SharePoint网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆