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.

how to have comments show

February 24, 2011 5:29pm

Subscribe [3]
  • #1 / Feb 24, 2011 5:29pm

    viktor89

    26 posts

    Hi guys.

    I’m having a hard time figuring something out. I want a weblog page on my site, so I created a template group called “blog”. Under blog my index is displaying the entries as excerpts and then there’s links to the post itself. I want comments to be available on the single-entry page.

    See http://roskilde-open.dk/index.php/blog/ for a reference.

    So, as of now I created the mentioned index page using the code below to desplay excerpts and link to the entries.

    {exp:channel:entries channel="blog" limit="10"}
            <h2><a href="http://{entry_id_path=blog/index}">{title}</a></h2>
    <p>        </p>
    
    <p>        Skrevet af <a href="http://roskilde-open.dk/index.php/member/1/">{author}</a> d. {entrydate} i kategorien <a href="http://{path=blog/index}">Blog</a><br />
            </p>
    
    <p>        {exp:word_limit total="50"}<br />
            {body}<br />
            {/exp:word_limit}</p>
    
    <p>        Læs resten af indlægget <a href="http://{entry_id_path=blog/index}">her</a></p>
    
    <p>        </p>
    
    <p>        <hr><br />
            </p>
    
    <p>        {exp:comment:preview}

    I also created a “comments” template containing this code:

    {exp:comment:preview}
    
    {comment}
    
    {/exp:comment:preview}
    
    {exp:comment:form channel="blog" preview="blog/index"} {if logged_out} <label for="name">Name:</label> <input type="text" name="name" value="{name}" size="50" /><br > <label for="email">Email:</label> <input type="text" name="email" value="{email}" size="50" /><br > <label for="location">Location:</label> <input type="text" name="location" value="{location}" size="50" /><br > <label for="url">URL:</label> <input type="text" name="url" value="{url}" size="50" /><br > {/if} <label for="comment">Comment:</label>
     <textarea name="comment" cols="70" rows="10">{comment}</textarea> <label><input type="checkbox" name="save_info" value="yes" {save_info} /> Remember my personal information</label>
     <label><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</label>
     {if captcha} <label for="captcha">Please enter the word you see in the image below:</label>
     {captcha}
     <input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p> {/if} <input type="submit" name="submit" value="Submit" /> <input type="submit" name="preview" value="Preview" /> {/exp:comment:form}

    What do I need to do from here?

    Thanks in advance

  • #2 / Feb 24, 2011 7:15pm

    Cheif

    626 posts

    Always start with the docs: http://ellislab.com/expressionengine/user-guide/modules/comment/recent_comments.html

    You’re using “preview” which is intended to show to the user adding a comment, you want to use:

    {exp:comment:entries sort="desc" orderby="date" limit="10" dynamic="no"}
  • #3 / Feb 25, 2011 3:56am

    viktor89

    26 posts

    Hi Cheif

    Thanks for the reply. The user guide is for the most part great, but this doesn’t help me much. It’s explaining this plugin, bur I still don’t get how I implement it on my site.

    Now I have a comments page saying:

    {exp:comment:entries sort="desc" orderby="date" limit="10" dynamic="no"}
    
    {comment}
    
    By {name} on {comment_date format="%Y %m %d"}
    
    From the entry '<a href="http://{comment_url_title_auto_path}">{title}</a>'.
    
    {/exp:comment:entries}
    
    {exp:comment:form channel="blog" preview="blog/index"} {if logged_out} <label for="name">Name:</label> <input type="text" name="name" value="{name}" size="50" /><br > <label for="email">Email:</label> <input type="text" name="email" value="{email}" size="50" /><br > <label for="location">Location:</label> <input type="text" name="location" value="{location}" size="50" /><br > <label for="url">URL:</label> <input type="text" name="url" value="{url}" size="50" /><br > {/if} <label for="comment">Comment:</label>
     <textarea name="comment" cols="70" rows="10">{comment}</textarea> <label><input type="checkbox" name="save_info" value="yes" {save_info} /> Remember my personal information</label>
     <label><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</label>
     {if captcha} <label for="captcha">Please enter the word you see in the image below:</label>
     {captcha}
     <input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p> {/if} <input type="submit" name="submit" value="Submit" /> <input type="submit" name="preview" value="Preview" /> {/exp:comment:form}

    How do I have that work on the single-entries (being at /index.php/blog/8 (or whatever ID the post has)?

    If I go to the comments template it’s just all blank :/

  • #4 / Feb 25, 2011 8:05am

    Mark Bowen

    12637 posts

    Hiya,

    First off make sure you don’t have your comment entries tag within the channel entries tag. I can’t completely tell if that’s what you do have or not from the code shown above but if it is nested then first fix that.

    Secondly take out the dynamic=“no” parameter on the comment entries tag. You need it to be dynamic so that it can pick up the information from the URL to enable it to show the correct comments. With it set to No like that means that it won’t know what to bring back unless you were to say supply an entry_id. That is unless of course you are trying to show just any comments and not just those related to the entry you’re showing?

    Hope that helps a bit.

    Best wishes,

    Mark

  • #5 / Feb 25, 2011 9:28am

    Ingmar

    29245 posts

    Thanks, Mark. Does that makes sense?

  • #6 / Feb 27, 2011 7:57am

    viktor89

    26 posts

    I got it working now, but I fear that I’m not completely understading it :/ I’ll mess around with it at bit 😛

  • #7 / Feb 28, 2011 3:29am

    John Henry Donovan

    12339 posts

    Glad you are up and running. A tutorial here might help. Its for EE1.x but same methods apply. Closing this one out for now. Feel free to start a new thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases