Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Associating master page with page Layout

  Asked By: Dominique    Date: May 23    Category: Sharepoint    Views: 13593

Does anybody know how can I associate custom page
layout I created from Sharepoint designer in
catalogs/masterPage gallery with a custom master page
I have created?

I tried using this attribute
MasterPageFile="~/myfile.master" but does not change
anything..

Share: 

 

8 Answers Found

 
Answer #1    Answered By: Nathaniel Henderson     Answered On: May 23

I don't have quite enough information to be 100% here, but I bet your layout
page inherits from a publishing page  layout [i.e.
Microsoft.SharePoint.Publishing.PublishingLayoutPage].
If that is the case, specifying won't change anything as it is "hard" coded at
the PublishingLayoutPage base class. You need to break that inheritance, and
your attribute will have the effect you are seeking.

 
Answer #2    Answered By: Tanner Moss     Answered On: May 23

If that isn't it, you need to provide the fully qualified path to the
custom master  Page:
MasterPageFile="~_catalogs/masterpage/myfile.master"

 
Answer #3    Answered By: Bobby Boyd     Answered On: May 23

I tried both the approaches.. hardcoding the path and
removing the inheritance..

The problem I am facing is I have already created  some
pages using that myfile.master masterpage with some
default layout. I want to add webpart to content area
on all these pages..So I have added this webpart to
the custom layout  file I created and once I add this
attribute to layout file
(MasterPageFile="~_catalogs/masterpage/myfile.master),

want all pages to show this webpart which isnt
happening..

 
Answer #4    Answered By: Sean Perez     Answered On: May 23

While I don't fully grasp your situation, any page  that continues to use
or was unghosted using the original
MasterPageFile="~masterurl/default.master" token will continue to use
the MasterUrl property of the Web to determine which master  Page to
show.

 
Answer #5    Answered By: Moises Harrington     Answered On: May 23

In addition, I think you might be confusing some concepts - specifically

once I add this attribute to layout  file
(MasterPageFile="~_catalogs/masterpage/myfile.master), want all pages to
show this webpart which isn't happening..

which is by design. Adding that attribute determines which master  page
the layout file uses, not the other way around. To get all pages to
show the web part in content, you'd have to switch each individual page
to use the new custom  layout, which is a page  level property.

 
Answer #6    Answered By: Kory Brock     Answered On: May 23

Yes, I think thats exactly what I am trying to do..

Any idea, what is page-level property which I would
have to tweak? Is it through SP designer?

 
Answer #7    Answered By: Ernesto Dawson     Answered On: May 23

ASPX pages using publishing features have a setting (available from the
web UI when in edit mode) which allow you to se the page  layout to be
used.

 
Answer #8    Answered By: Santiago Hood     Answered On: May 23

By default any pages not found in the _Layouts directory have their
MasterPage set to the token of ~masterUrl/default.master. This refers
them to a property of the SPWeb object stored in SharePoint called
MasterUrl which holds the path to the masterpage that will be used. In
a normal site this property is set to
_catalogs/masterpage/default.master, which points to the default.master
file in the masterpage gallery  of the site. Until the page  in the
gallery is customized it points to the default.master in the
Template/Global directory of the 12 hive.

You can use SPD to select a different .master file to be associated with
each layout  page, but that is page specific. You can also use SPD to
edit the .master in the Site's master  page gallery, which would apply to
every page in the site. You can also use the SharePoint Object model to
write a program that will modify the MasterUrl property of the SPWeb
object which will change the masterpage for the whole site without
unghosting objects to the database like SPD will. Finally, you could
edit the masterpagefile attribute of every page using SPD to change what
masterpage it uses.

You said you did this for the layout page. If you are using publishing
I suspect that means you changed the layout template from which new
pages are created. This will not change the page after it has been
created. It will change any new pages created. To change the already
created pages you would need either change the global setting (see
previous paragraph) or edit each page. I also think you have a
different problem with the setting you are using. If you are going to
hardcode the setting I think you want the address
'~site/_catalogs/masterpage/default.master'. I don't think the address
you are using will be evaluated as valid. If the site doesn't find the
specified masterpage SharePoint will fall back to the default.master in
the 12 hive. So your problem may be that you are either changing the
layout template in publishing or that your masterpage address is wrong.

 
Didn't find what you were looking for? Find more on Associating master page with page Layout Or get search suggestion and latest updates.




Tagged: