ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Comment form won’t show

June 14, 2012 6:07pm

Subscribe [3]
  • #1 / Jun 14, 2012 6:07pm

    Matthew81

    81 posts

    I’m trying to set up a blogging system for about six to eight of our authors. My requirements are as follows:

    1.) “Master” blog page, where recent posts from every blogger will show
    2.) “Individual” blog page, where each author’s own posts will show
    3.) “Single-View” page, where an individual post will be displayed
    4.) To keep short, semantic URLs, #1 above is located at /blogs/, #2 is at /blogs/username/, and #3 is at /blogs/username/post-title

    Sadly, I can’t get the comment form to show with more than two segments in the URL.

    Here’s my relevant code:

    {if segment_2 == ""}
     {!-- Blogs homepage:  <a href="http://example.com/blogs/">http://example.com/blogs/</a> --}
     <h1>Recent Posts:</h1>
     {exp:channel:entries channel="{pre_channel}" limit="20" disable="categories|member_data"}
      <h2 class="column"><span><a href="/blogs/{username}/{url_title}">{title}</a><span></h2>
      <div>
       <i>Posted by {author} on {entry_date format="%F %d, %Y"}</i>
    
       {blurb}<a href="/blogs/{username}/{url_title}">Read Post</a>
      </div>
     {/exp:channel:entries}
    {/if}
    {if segment_2 != "" AND segment_3 == ""}
     {!-- Individual Blog: <a href="http://example.com/blogs/username/">http://example.com/blogs/username/</a> --}
     {exp:channel:entries channel="{pre_channel}" username="{segment_2}" limit="20" disable="categories|member_data"}
      <h2 class="column"><span><a href="/blogs/{username}/{url_title}">{title}</a><span></h2>
      <div>
       <i>Posted by {author} on {entry_date format="%F %d, %Y"}</i>
    
       {blurb}<a href="/blogs/{username}/{url_title}">Read Post</a>
      </div>
     {/exp:channel:entries}
    {/if}
    {if segment_3 != ""}
     {!-- Individual Post: <a href="http://example.com/blogs/username/post-title-goes-here">http://example.com/blogs/username/post-title-goes-here</a> --}
     {exp:channel:entries channel="{pre_channel}" url_title="{segment_3}" limit="1" disable="categories|pagination|member_data"}
      <div>
       <h1>{title}</h1>
       <i>By {author}, {entry_date format="%F %d, %Y"}</i>
       <div>{blog_post}</div>
      </div>
      {snp_comment_form}
     {/exp:channel:entries}
    {/if}

    The comment form will not appear when viewing the single-entry page.  If I change the final {if} statement to check for segment_2 instead and remove the /username/ segment of the URL, then it works.  I know this is definitely a workable thing to set up, but I really need the semantic and organized “feel” of having each user’s posts categorized under their own “directory.”

    Thanks for any ideas,

    Matthew

  • #2 / Jun 16, 2012 2:38pm

    John St-Amand

    865 posts

    I could be wrong, but it may simply have to do with your having the comment form on the single entry view nested inside your entries loop. Shouldn’t it be outside, per the docs?

  • #3 / Jun 16, 2012 8:36pm

    Matthew81

    81 posts

    I could be wrong, but it may simply have to do with your having the comment form on the single entry view nested inside your entries loop. Shouldn’t it be outside, per the docs?

    Thank you for the suggestion, but unfortunately, moving it outside the entries loop still did not show the form.

  • #4 / Jun 18, 2012 9:42am

    MadWebDesigns

    147 posts

    Hi Matthew81,

    Try changing your second if statement to the following:

    ....
    {if segment_2 != "" && segment_3 == ""}
    ....

    Mike

  • #5 / Jun 18, 2012 10:26am

    Matthew81

    81 posts

    Thank you for posting, but sadly it still is not working.  I also tried making my {if} statements into {if:else} but that also didn’t work.  The form simply will not show up.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases