Newsletter Module in Layout.Master

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.
7/27/2010 9:15:10 PM
Gravatar
Total Posts 131

Newsletter Module in Layout.Master

I'm sure there is a way to do this but I don't know how.

I'd like to drop the newsletter control onto layout.master so that it is available on every page. In this version of mojo I am using the compiled version so I'd like to not have to update any code behinds.

The thing is, the newsletter module is built to take settings from the hashtable for modules. Is there a way to set those settings without code (or I guess I could us inline code) at the module level. I think this would be helpful for any custom page that wants to use a mojo module but outside of the CMS.

Hope I make sense and that someone can help.

David

7/27/2010 9:56:51 PM
Gravatar
Total Posts 2169

Re: Newsletter Module in Layout.Master

Hi David,

Check out this page: http://www.mojoportal.com/same-content-on-all-pages.aspx

I think it will answer your questions.

HTH,
Joe D.

7/28/2010 7:33:10 AM
Gravatar
Total Posts 18439

Re: Newsletter Module in Layout.Master

NewsletterModule is really just a wrapper around another control that you could use directly in layout.master

<portal:Subscribe ID="subscribe1" runat="server" />

all the module is doing is setting some properties on the control, but these could also be set declaratively right on the control.

Inside the module it sets properties based on module settings like this:

subscribe1.ShowList = NewsletterShowListSetting;
            subscribe1.IncludeDescriptionInList = NewsletterIncludeDescriptionInListSetting;
            subscribe1.ShowFormatOptions = NewsletterShowFormatOptionsSetting;
            subscribe1.HtmlIsDefault = NewsletterHtmlIsDefaultSetting;
            subscribe1.ShowMoreInfoLink = NewsletterShowmoreInfoLinkSetting;
            subscribe1.ShowPreviousEditionsLink = NewsletterShowPreviousEditionLinksSetting;
            subscribe1.OverrideInputWidth = NewsletterOverrideInputWidthSetting;

but you can also set those properties declaratively right on the control declaration like:

<portal:Subscribe ID="subscribe1" runat="server" ShowList="true" IncludeDescriptionInList="true" HtmlIsDefault="true" ShowMoreInfoLink="true" ShowPreviousEditionsLink="true" />

Best,

Joe

7/28/2010 7:36:02 AM
Gravatar
Total Posts 2169

Re: Newsletter Module in Layout.Master

Hey Joe,

I like that approach a lot better than the ModuleWrapper. I think I'll create some documentation about using the Newsletter Control in this manner.

Later,
Joe D.

7/28/2010 7:37:29 AM
Gravatar
Total Posts 18439

Re: Newsletter Module in Layout.Master

That would be great Joe!

Many thanks!

7/29/2010 10:58:34 AM
Gravatar
Total Posts 131

Re: Newsletter Module in Layout.Master

I placed the Subscribe control in layout.master. When trying to update some page settings the subscribe module was causing an page.validate to fail. I have not tried any other submits but guess any controls calling page.isvalid would cause this error. Not sure if this is a bug or something in my implementation. 

Thoughts?

P.S. Thanks for all the community help. It really makes my life easier (guess it's time to buy some more beers).

7/29/2010 11:46:12 AM
Gravatar
Total Posts 18439

Re: Newsletter Module in Layout.Master

Hi David,

I guess technically it is a bug since it can be fixed.

Basically the issue is that we are calling Page.Validate(); before we save page settings and this causes it to validate all items on the page.

The solution is to use a validation group and only validate the group, actually we already have the validation group for pagesettings so changing the code like this should solve it.

Page.Validate("pagesettings");

The subscribe control internally already does it correctly so it won't affect other items on a page like this:

Page.Validate("subscribe");

I will fix this, let me know any other pages where it happens as I expect it will happen elsewhere on administrative pages where I wasn't anticipating other things on the page that may have validators. I'll look around in the admin pages myself.

Best,

Joe

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