切换SharePoint发布页面的PageLayout和Mast

切换SharePoint发布页面的PageLayout和Mast

本文介绍了如何动态切换SharePoint发布页面的PageLayout和MasterPage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了改善SharePoint WCM发布页面的编辑和显示体验,我希望能够在编辑模式下切换到一组特殊的Masterpage/PageLayout.

To improve both the editing and displaying experience of SharePoint WCM Publishing pages I would like to be able to switch to a special set of Masterpage/PageLayout when in edit mode.

因此我想在/_catalogs/masterpage中拥有

So in /_catalogs/masterpage I want to have:

MyMasterpage.master-显示模式的母版MyMasterpage-edit.master-用于编辑模式的母版,仅在可用时使用MyPageLayout.aspx-显示模式的页面布局MyPageLayout-edit.aspx-编辑模式下的页面布局,仅在可用时使用

MyMasterpage.master - masterpage for display modeMyMasterpage-edit.master - masterpage for edit mode, only use if availableMyPageLayout.aspx - pagelayout for display modeMyPageLayout-edit.aspx - pagelayout for edit mode, only use if available

当我在Pages库中创建新的发布页面时,选择MyPageLayout页面布局.

When I create a new publishing page in the Pages library, I select the MyPageLayout page layout.

渲染页面时,就像服务器控件一样,我想检测我是否处于编辑显示"模式.该控件执行以下代码来确定渲染模式:

When rendering the page I would like to detect if I'm in Edit of Display mode, just like the server control does. This control executes the following code to determine the render mode:

private void calculateShouldRender()
{
    SPControlMode contextualFormModeFromPostedForm = ConsoleUtilities.GetContextualFormModeFromPostedForm();
    if ((SPControlMode.Display == contextualFormModeFromPostedForm) && (PageDisplayMode.Display == this.PageDisplayMode))
    {
        this.shouldRender = true;
    }
    else if ((SPControlMode.Edit == contextualFormModeFromPostedForm) && (PageDisplayMode.Edit == this.PageDisplayMode))
    {
        this.shouldRender = true;
    }
    else
    {
        this.shouldRender = false;
    }
    this.Visible = this.shouldRender;
}

如果渲染模式为编辑",我想切换到MyMasterpage-edit.master母版页和MyPageLayout-edit.aspx页面布局.

If the render mode is Edit, I want to switch to the MyMasterpage-edit.master materpage and the MyPageLayout-edit.aspx pagelayout.

我可以在由服务器控件控制的母版页和页面布局中进行较大的切换,但是我想拆分可重复性. SharePoint Analist可以创建最佳的编辑模式页面,前端开发人员可以创建整洁美观的显示模式页面,而不会出现所有编辑混乱的情况.

I could make a big switch in the masterpage and pagelayout controlled by server controls, but I would like to split resposibilities. A SharePoint Analist can create optimal edit mode pages, and a front end developer can create clean and beautiful display mode pages without all the editing clutter.

关于如何实现此目标的任何想法?切换母版似乎不是问题,我曾经写过一个博客文章.困难的事情似乎是页面布局的切换.

Any ideas on how to accomplish this? Masterpage switching does not seem the problem, I once wrote a blogpost on this. The difficult thing seems the switching of the page layout.

推荐答案

对这个问题的明确答案现在被烘焙"到了我们称为DualLayout for SharePoint的产品中!我们的方法解决了您所有的SharePoint WCM设计难题:

The definitive answer to this question is now "baked" into a product which we call DualLayout for SharePoint! Our approach solves all your SharePoint WCM design nightmare:

  • 除了WCM编辑和显示视图之外,还为最终用户引入其他视图
  • SharePoint样式与您自己的样式之间永远不会发生冲突
  • 使精简"的意思是查看"母版页和页面布局不干扰WCM母版页和页面布局
  • 为最终用户制作超轻巧的页面,消除所有SharePoint特定页面的混乱状况
  • 改善页面的性能,因为我们只有极少的控件集可以在最终用户视图中呈现

http://www上进行检查. macaw.nl/Het+Bedrijf/Producten/Macaw+DualLayout+for+SharePoint.aspx ,请参阅该页面博客卷中的博客文章以获取详细的背景信息.

Check it out at http://www.macaw.nl/Het+Bedrijf/Producten/Macaw+DualLayout+for+SharePoint.aspx, see the blog posts in the blog roll of that page for detailed background information.

这篇关于如何动态切换SharePoint发布页面的PageLayout和MasterPage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 13:51