Different Master Templates

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
12/29/2010 8:43:15 AM
Gravatar
Total Posts 34

Different Master Templates

Hi All,

I have read through all the forum posts about how I should use different skins for different templates and set them within the page properties, which is fine, just not for what I am doing :-)

I am creating an app from scratch that will be within Mojo portal, so it can blend in with all my CMS content and use the logon and roles etc.  I have made apps before, where I create user controls and add them to Mojo pages and this works fine, but gets rather time consuming to do things when you get many many pages etc.

So this time round I have followed Joe's tutorial more closely with separate projects and Xcopying pages and DLL's from my project. This all works fine, but I just can't seem to make it use any other Master template on my pages that inherit MojoBasePage.  Is this because this will automatically set the template to the skin when it runs?

I am trying to just create a template based on the one I'm using for the CMS renaming it to something different putting it in the masterpages dir on the root and pointing my pages at it and making a few layout changes. However, it always seems to still point at the one in the skins folder.

I guess my main questions are:

  • Is what I'm doing even going to work?
  • If it doesn't work, can I create a new skin as standard and programmatically set my skin when my custom page loads?
  • If all above doesn't work how can I do it :-)

Thanks Joe/Anyone for your help!!

Matt

 

12/29/2010 9:10:09 AM
Gravatar
Total Posts 18439

Re: Different Master Templates

The best recommendation I have if you want to use a custom skin on a custom page that inherits from mojoBasePage is as follows:

yes it needs to be a standard mojoPortal skin and it needs to be located in the /Data/Sites/[SiteID]/skins folder like all other skins.

you can set it programmatically to the chosen skin from code in OnPreInit like this example code where I am forcing a custom page to use the artisteer-greenlagoon skin.

protected override void OnPreInit(EventArgs e)
{
 base.OnPreInit(e);

 MasterPageFile = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/skins/artisteer-greenlagoon/layout.Master";
 StyleSheetCombiner style = Page.Master.FindControl("StyleSheetCombiner") as StyleSheetCombiner;
 if (style != null)
 {
  style.OverrideSkinName = "artisteer-greenlagoon";
 }
}

Hope it helps,

Joe

12/29/2010 9:38:46 AM
Gravatar
Total Posts 34

Re: Different Master Templates

Thanks so much Joe!!

I'm glad I gave up trying and asked, as I would never have worked that out!!

Keep up the good work and thanks for the fast reply.

Matt

12/29/2010 10:33:46 AM
Gravatar
Total Posts 34

Re: Different Master Templates

Hi Joe,

I'm almost there :-) It now uses the template from the new skin directory, but still uses the style.css etc from the CMS set skin directory.

Is there a way to point it at the new set of stylesheets as well?

Many Thanks

Matt

12/29/2010 10:57:09 AM
Gravatar
Total Posts 18439

Re: Different Master Templates

Makes sure this is true and not set to false in user.config

<add key="CombineCSS" value="true"/>

you really should not make it load separate css files so this should always be true.

Hope it helps,

Joe

12/29/2010 11:04:14 AM
Gravatar
Total Posts 34

Re: Different Master Templates

Hi Joe,

I have that in web.config and in my user.config as true :-(

I at first assumed it wasn't even getting to the new directory, but I added some random text to the new skin dir's master template and it showed on the web page.  I then changed the back ground colour on both the css skin directory and my forced skin directory to two different colours and it shows up the colour on the CSS skin directory :-( not my new skins dir

It's like it is pointing at the template ok, but still using the css set dir to pick up the style sheets....

Any more help appreciated

Matt

12/29/2010 11:39:39 AM
Gravatar
Total Posts 18439

Re: Different Master Templates

Make sure your layout.master file has this control and with this exact id

<portal:StyleSheetCombiner id="StyleSheetCombiner" runat="server" />

when you view the source of the page there should not be a bunch of separate css files it should have csshandler.ashx?skin=yourcustomskinname

Hope it helps,

Joe

12/29/2010 12:00:02 PM
Gravatar
Total Posts 34

Re: Different Master Templates

Hi Joe,

I am a complete fool.... I think my brain has been stuck on too many things today!!!  I was assigning the correct master template and using the old template directory name on style.OverrideSkinName = "" Sadly they were almost identical, so I didn't notice.

Really appreciate the help, everything is working as expected now.  When one day I actually work out how to use Mojoportal to a decent level I can help out some other poor plebs like me at the moment with it

Time to call it a day and have a beer

Cheers and keep up the great work!!!

Matt

 

 

12/29/2010 12:23:46 PM
Gravatar
Total Posts 18439

Re: Different Master Templates

Hey Matt,

Thanks for the beer! Much appreciated.

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.