开发者

ExpressionEngine not showing when there are no comments

I can't seem to figure out why ExpressionEngine is not displaying the message when there are when there are no comments. The way it works now, when there are no comments nothing is displayed. When there is one comment, the comment is displayed. I also noticed when there are no comments it won't execute anything inside of the comment:entries loop.

{exp:comment:entries channel="article" url_title="{segment_4}" orderby="{entry_date}" sort="desc" dynamic=“no”}
    {if no_results}
        <p>Nothing has been said yet. <a href="#leave-a-comment">Write something.</a></p>
    {/if}

        {comment}
        <p class="comment-by">By {if "{url}" != ""}<a href="{url}">{name}</a>{if:else}{name}{/if}  on {comment_date forma开发者_如何转开发t="%Y %m, %d"}</p>
{/exp:comment:entries}


I'm unable to test this, but you have dynamic="no" on, and url_title="{segment_4}".

dynamic="no" prevents the URI from having any effect on the content of a weblog. Whether this has any effect when the url_title is specified using a {segment_x} variable, I do not know. (This is speculation)

However your code seems needlessly complicated, when the following will work fine for a single page entry:

{exp:comment:entries sort="asc" limit="20"}
{if no_results} There are no comments... {/if}    

{comment}

<p>By {name} on {comment_date format="%Y %m %d"}</p>

{/exp:comment:entries}

You don't need to specify channel/url_title in the comments tag (assuming you are on a single page entry, which I believe you are from your post).

Try that, see if you get the desired result.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜