MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

How to get ALL BLOG POSTS on the homepage ?  (Mono Support )

Viewed 11965 time(s), 7 post(s) 7/18/2012 11:31:58 AMby super
super

super

7/18/2012 11:31:59 AM
How to get ALL BLOG POSTS on the homepage ? I would like to display content of Blog.aspx page on the homepage, how to do that ?
This content has not been rated yet. 
6018 Reputation 709 Total posts
khorvat

khorvat

7/18/2012 1:15:20 PM
Hi,

you will need to instantiate BlogContainer module on your home page e.g.
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>
<%@ Register TagPrefix="MonoX" TagName="BlogContainer" Src="/MonoX/ModuleGallery/Blog/BlogContainer.ascx" %>
 
<portal:PortalWebPartZoneTableless HeaderText='<%$ Code: PageResources.Zone_LeftPartZone %>' ID="leftPartZone" runat="server" Width="100%" ChromeTemplateFile="LeftColumn.htm">
      <ZoneTemplate>
          <MonoX:BlogContainer ID="blogContainer" runat="server" UsePrettyPhoto="true" DateFormatString="d"
          RelatedContentVisible="false" EnableSyntaxHighlighter="true" GravatarRenderType="NotSet" />
      </ZoneTemplate>
  </portal:PortalWebPartZoneTableless>
Note: Put the module in the PortalWebPartZoneTableless only if you want to dynamically administer the module, if not please us this

<MonoX:BlogContainer ID="blogContainer" runat="server" UsePrettyPhoto="true" DateFormatString="d"
          RelatedContentVisible="false" EnableSyntaxHighlighter="true" GravatarRenderType="NotSet" />

Also note that BlogContainer will use the BlogSlug from the url if any, if not you need to manually set the BlogSlug if you want to bound the module to specific blog.


Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
khorvat

khorvat

7/18/2012 1:16:30 PM
One more thing you need to change the URL rewriting if you want fancy URLs, you can find them in the web.config

<!-- dynamic blog post rules, can be used regardless of the actual name of the page that holds blog parts -->
<rewrite url="^(.*)/(.*)/post/(.*)/(.*)/(.*)/BlogCommentsPageNo/(.*)/BlogFilesPageNo/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&BlogCommentsPageNo=$6&BlogFilesPageNo=$7&$9" name="BlogPostCommentsFiles" defaultPage="/Blog.aspx" urlPattern="/{PageName}/post/{Blog.Slug}/{IdentityId}/{Slug}/" />
<rewrite url="^(.*)/(.*)/post/(.*)/(.*)/(.*)/BlogFilesPageNo/(.*)/BlogCommentsPageNo/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&BlogFilesPageNo=$6&BlogCommentsPageNo=$7&$9" name="BlogPostFilesComments" defaultPage="/Blog.aspx" urlPattern="/{PageName}/post/{Blog.Slug}/{IdentityId}/{Slug}/" />
<rewrite url="^(.*)/(.*)/post/(.*)/(.*)/(.*)/BlogFilesPageNo/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&BlogFilesPageNo=$6&$8" name="BlogPostFiles" defaultPage="/Blog.aspx" urlPattern="/{PageName}/post/{Blog.Slug}/{IdentityId}/{Slug}/" />
<rewrite url="^(.*)/(.*)/post/(.*)/(.*)/(.*)/BlogCommentsPageNo/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&BlogCommentsPageNo=$6&$8" name="BlogPostComments" defaultPage="/Blog.aspx" urlPattern="/{PageName}/post/{Blog.Slug}/{IdentityId}/{Slug}/" />
<rewrite url="^(.*)/(.*)/post/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&$7" name="BlogPost" defaultPage="/Blog.aspx" urlPattern="/{PageName}/post/{Blog.Slug}/{IdentityId}/{Slug}/" />
<rewrite url="^(.*)/(.*)/posts/(.*)/BlogPostPage/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostPage=$4&$6" name="BlogPostsPaged" defaultPage="/Blog.aspx" urlPattern="/{PageName}/posts/{Slug}/BlogPostPage/{PageNo}/" />
<rewrite url="^(.*)/(.*)/posts/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&$5" name="BlogPosts" defaultPage="/Blog.aspx" urlPattern="/{PageName}/posts/{Slug}/" />
<rewrite url="^(.*)/(.*)/search/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&SearchAction=$4&SearchValue=$5&$7" name="BlogSearch" defaultPage="/Blog.aspx" urlPattern="/{PageName}/search/{Slug}/{SearchAction}/{SearchValue}/" />
<rewrite url="^(.*)/(.*)/blog-tag/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&SearchAction=tag&SearchValue=$4&$6" name="BlogTag" defaultPage="/Blog.aspx" urlPattern="/{PageName}/blog-tag/{Slug}/{Tag}/" />
<rewrite url="^(.*)/(.*)/settings/(.*)/(\?(.+))?$" to="$1/$2.aspx?ShowBlogSettings=true&BlogSlug=$3&$5" name="BlogSettings" defaultPage="/Blog.aspx" urlPattern="/{PageName}/settings/{Slug}/" />
<rewrite url="^(.*)/(.*)/comments/(.*)/BlogCommentsPageNo/(.*)/(\?(.+))?$" to="$1/$2.aspx?ShowBlogCommentsAdmin=true&BlogSlug=$3&BlogCommentsPageNo=$4&$6" name="BlogCommentsAdminComments" defaultPage="/Blog.aspx" urlPattern="/{PageName}/comments/{Slug}/" />
<rewrite url="^(.*)/(.*)/comments/(.*)/(\?(.+))?$" to="$1/$2.aspx?ShowBlogCommentsAdmin=true&BlogSlug=$3&$5" name="BlogCommentsAdmin" defaultPage="/Blog.aspx" urlPattern="/{PageName}/comments/{Slug}/" />
<rewrite url="^(.*)/(.*)/edit/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&BlogEditMode=true&$7" name="BlogPostEdit" defaultPage="/Blog.aspx" urlPattern="/{PageName}/edit/{Blog.Slug}/{IdentityId}/{Slug}/" />
<rewrite url="^(.*)/(.*)/insert/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogInsertMode=true&$5" name="BlogPostInsert" defaultPage="/Blog.aspx" urlPattern="/{PageName}/insert/{Slug}/" />
<!-- shows all blog posts regardless of the blog they were posted to -->
<rewrite url="^(.*)/(.*)/posts/(\?(.+))?$" to="$1/$2.aspx$3" name="AllBlogPosts" defaultPage="/Blog.aspx" urlPattern="/{PageName}/posts/{Slug}/" />
<rewrite url="^(.*)/(.*)/posts/(.*)/wlwmanifest.xml(\?(.+))?$" to="$1/wlwmanifest.xml" name="WlwManifest" urlPattern="/wlwmanifest.xml" />


Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
super

super

7/18/2012 4:36:41 PM
Thank you khorvat - I will try the code and I just found out that I can also move / add modules dynamically by drag n drop on the homepage which is a great feature. If I add all blog module on the homepage side column, i won't have to touch the code - great feature.
This content has not been rated yet. 
6018 Reputation 709 Total posts
khorvat

khorvat

7/19/2012 6:45:38 AM
Yep, you can instantiate everything dynamically via WebPart and Zones so every module can be dropped to the Zone, I just thought that you want to get  your hands dirty and do some programming :)

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
super

super

7/19/2012 10:45:28 AM
Lol...I will do that in required.

Quick question: Once I re-arrange or add / delete modules via webpart and zones and in future if I upgrade the monoX to the next higher version - will this zone arrange will remain same (means will be saved in database) or i will have to re-arrange everything from starting once again after every upgrade of monoX ?
This content has not been rated yet. 
6018 Reputation 709 Total posts
khorvat

khorvat

7/19/2012 3:34:41 PM
It will be saved in the database so your modules and module settings are safe.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts