Changing the page title and description from a module

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.
11/21/2013 8:18:47 AM
Gravatar
Total Posts 19

Changing the page title and description from a module

Hi All,

I have a module that generates code from my database depending on what parameters are sent to it and I have used FriendlyUrls to try and make this SEO friendly (Google still isn't indexing these pages tho!)

I want to also change the page title and description depending on what the dynamic content is. I have tried code like the following:

  PageSettings pageSettings =  CacheHelper.GetCurrentPage();
  pageSettings.PageTitle = moduleTitle.Text;

It appears to set the page settings, but this doesn't translate back into the browser source markup. Could some one give me a pointer on a way of doing this?

Thanks

Matt

 

11/21/2013 9:38:59 AM
Gravatar
Total Posts 1204
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Changing the page title and description from a module

When you say "module" are you talking about a custom mojoPortal feature? What you're describing is more appropriate to do in a standalone aspx page, since when creating a feature to place a mojoPortal CMS page, the CMS is not going to like extra URL parameters (it's doing it's own friendly page processing behind the scenes). Features have to be able to play nice with whatever else is sitting on the page.

With a dedicated aspx page, you can do everything you're describing, no problem, and it will appear to be just another page of the CMS to your visitors. Take a look at source for any of the admin pages and that will give you a good starting point.

Jamie

11/21/2013 9:44:48 AM
Gravatar
Total Posts 19

Re: Changing the page title and description from a module

Hi,

Yes it is a User Control and I got around the Friendly URL's by also passing the page id in the query string. I have used custom pages for some other things but one thing I didn't like was not having the ability to add in side panels dynamically using mojoportal as you can do on all other pages.  Or am I doing something wrong? Should you be able to add/remove side panels without hard coding them in mark up?

Thanks

Matt

11/21/2013 10:42:08 AM
Gravatar
Total Posts 18439

Re: Changing the page title and description from a module

Seems weird for a module to change the page title, when you could just put the page title you want in PageSettings.

However if you really want to change the page title from within the module don't modify the pagesettings object because by the time your module is loaded the pagesettings title have already been set on the page so changing the pagesettings object has no effect at that point.

Instead just change the title on the Page directly

Page.Title = module.Title;

however if more than one module on a page does this the last one wins.

 

11/21/2013 10:45:56 AM
Gravatar
Total Posts 18439

Re: Changing the page title and description from a module

Some included features like the blog have settings whether to load page side content on supporting pages.

See how the blog category page calls the LoadSideContent method of the basepage for example. it passes in booleans for left and right content to be loaded or not.

11/21/2013 10:53:51 AM
Gravatar
Total Posts 19

Re: Changing the page title and description from a module

Thanks Jamie/Joe,

I am now going down the static page route as suggested by Jamie and now the page settings seem to work perfectly when changed.

Thanks for the tip Joe about the side panels, that's awesome!

Matt

11/21/2013 12:42:26 PM
Gravatar
Total Posts 19

Re: Changing the page title and description from a module

Ok... last bit of help on this one hopefully :-)

Everything works brilliantly, except that my side panels are automatically loaded with my home page side data.  I tried setting a page guid in frindlyurl's and also tried creating a mojoportal page and pointing it at my static page then getting the guid from the db and using that in the friendly url pageguid.

I am sure I am missing something obvious :-)

Thanks as always

Matt

 

11/21/2013 12:54:37 PM
Gravatar
Total Posts 18439

Re: Changing the page title and description from a module

you must pass in the pageid param in the url to your page otherwise you get the default page

supporting pages work the same as cms pages in this regard, just as you see the pageid in the url for blog supporting pages or forum supporting pages like this one. only difference on cms pages is that the friendly urls hide the params but the real url has the parameters

11/21/2013 4:13:39 PM
Gravatar
Total Posts 19

Re: Changing the page title and description from a module

Thanks Joe! All working now :-)
 

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