Blog module outputs comment markup when comments are switched off

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
8/15/2015 6:06:03 AM
Gravatar
Total Posts 537
feet planted firmly on the ground

Blog module outputs comment markup when comments are switched off

If a blog has comments disabled in its setting, this is rendered on the page in list view:

<div class="blogcommentlink">     &nbsp;     </div>

which turns into unwanted vertical space. Can this be excluded when comments are disabled please? A clean solution is to replace this in PostList.ascx:

<div class="blogcommentlink">

<asp:HyperLink ID="Hyperlink2" runat="server" EnableViewState="false" Text='<%# FeedBackLabel + "(" + DataBinder.Eval(Container.DataItem,"CommentCount") + ")" %>'

Visible='<%# AllowComments && ShowCommentCounts %>' NavigateUrl='<%# FormatBlogUrl(DataBinder.Eval(Container.DataItem,"ItemUrl").ToString(), Convert.ToInt32(DataBinder.Eval(Container.DataItem,"ItemID"))) %>'

CssClass="blogcommentlink"></asp:HyperLink>

<asp:HyperLink ID="Hyperlink1" runat="server" EnableViewState="false" Text='<%# FeedBackLabel %>'

Visible='<%# Config.AllowComments && !ShowCommentCounts %>' NavigateUrl='<%# FormatBlogUrl(DataBinder.Eval(Container.DataItem,"ItemUrl").ToString(), Convert.ToInt32(DataBinder.Eval(Container.DataItem,"ItemID"))) %>'

CssClass="blogcommentlink"></asp:HyperLink>&#160;

</div>

with this:

<asp:Panel id="blogCommentLink" runat="server" cssclass="blogcommentlink" Visible='<%# AllowComments %>' >

<asp:HyperLink ID="Hyperlink2" runat="server" EnableViewState="false" Text='<%# FeedBackLabel + "(" + DataBinder.Eval(Container.DataItem,"CommentCount") + ")" %>'

Visible='<%# AllowComments && ShowCommentCounts %>' NavigateUrl='<%# FormatBlogUrl(DataBinder.Eval(Container.DataItem,"ItemUrl").ToString(), Convert.ToInt32(DataBinder.Eval(Container.DataItem,"ItemID"))) %>'

CssClass="blogcommentlink"></asp:HyperLink>

<asp:HyperLink ID="Hyperlink1" runat="server" EnableViewState="false" Text='<%# FeedBackLabel %>'

Visible='<%# Config.AllowComments && !ShowCommentCounts %>' NavigateUrl='<%# FormatBlogUrl(DataBinder.Eval(Container.DataItem,"ItemUrl").ToString(), Convert.ToInt32(DataBinder.Eval(Container.DataItem,"ItemID"))) %>'

CssClass="blogcommentlink"></asp:HyperLink>&#160;

</asp:Panel>

In the interim we can of course disappear this area with css, but it would be nice if the markup was as clean as possible for the configured settings.

Also in the list, could we also disappear the Statistics entry for comments when comments are disabled. We get this output:

<li id="ctl00_mainContent_ctl00_postList_navTop_stats_liComments">Comments (0)</li>

which can be fixed by adding the "else" here in PostList.ascx.cs:

if (config.AllowComments)

{

...

}

else

{ navTop.ShowCommentCount = false; }

 

 

8/18/2015 11:01:13 AM
Gravatar
Total Posts 18439

Re: Blog module outputs comment markup when comments are switched off

these fixes are now in the source code repository

note that I did not change the div to a panel, I just added the id runat and visible properties to the existing div

Thanks,

Joe

8/19/2015 2:10:12 PM
Gravatar
Total Posts 537
feet planted firmly on the ground

Re: Blog module outputs comment markup when comments are switched off

Thanks Joe. 

(I initially tried the same with that div (runat="server" etc) but for some reason it kept frying everything and I got build errors - maybe needed to delete and recreate the designer file or something? I should stick to the day job ;-)

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