2

I am working on my blog/tutorial site and I have it set up so the main page displays my content and the user can click on an individual entry and go to a page that displays just that entry through my "video_tutorial" template. I have the comment module installed and have been adding in some comment tags and such, however nothing is showing up. So I am not sure if I am using the wrong tags or what, so I thought I would start over and get some feedback first.

I am not sure if this is something I just need to enable somewhere in expression engine or if I need to use another language. I just need the user to be able to enter a name and a comment. I have seen some examples of adding facebook logins, I don't need to go that direction, if Expression Engine has a commenting system built in that would work for me assuming I can still style it.

http://ellislab.com/expressionengine/user-guide/modules/comment/index.html#id11 I have used this as a basis and I used the code it has in the "comment submission form" area thinking that would assist me but to no success. I swapped out the channel with what I needed too. Any help is greatly appreciated. Thank you!

Here is my code for my "video_tutorial" template which is set up to show a single entry and I want the comment section to go underneath there for users to discuss the content of the video or learn among themselves as well.

Revised Code in my video_tutorial/comment template group/template

{exp:comment:form channel="video_tutorial" url_title="video_tutorial/comment" preview="channel/preview"}

    {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><br />
    <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><br />
    <label><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</label><br />

    {if captcha}
            <label for="captcha">Please enter the word you see in the image below:</label><br />
            <p>{captcha}<br />
            <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}

Here is my code for my video_tutorial template group.

    <!DOCTYPE html>

<html>
<head> 
<title>Reanimated Fallout | Animation & Motion Graphics Tutorials, Training & More</title>

<!-- stylesheet -->
<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=fallout_stylesheet/fallout_css}" /> 
</head>


<header>
        <div id="buttonbar">
        <div class="wrapper">   
        <div id="navigation">
            <div id="logo">
            <a href= "http://reanimatedfallout.com/index.php?/reanimatedfallout"><img src="images/reanimated_fallout_logo.png"></a>
            </div>
        </div>
        </div>
        </div>
<!-- navigation buttons -->

            <div class="wrapper">           
            <ul id="buttons">

                <li>
                <a href= "http://reanimatedfallout.com/index.php?/after_effects"><img src="images/navigation/after_effects_btn.png"></a>
                </li>

                <li> 
                <a href= "http://reanimatedfallout.com/index.php?/cinema_4d"><img src="images/navigation/cinema_4d_btn.png"></a>
                </li>

                <li> 
                <a href= "http://reanimatedfallout.com/index.php?/photoshop"><img src="images/navigation/photoshop_btn.png"></a>
                </li>

                <li> 
                <a href= "http://reanimatedfallout.com/index.php?/premiere"><img src="images/navigation/premiere_btn.png"></a>
                </li>

                <li> 
                <a href= "http://reanimatedfallout.com/index.php?/reviews"><img src="images/navigation/reviews_btn.png"></a>
                </li>

                <li> 
                <a href= "http://reanimatedfallout.com/index.php?/apple"><img src="images/navigation/apple_btn.png"></a>
                </li>

                <li> 
                <a href= "http://reanimatedfallout.com/index.php?/about"><img src="images/navigation/about_btn.png"></a>
                </li>
            </div>
            </ul>


</header>


<body>

{exp:channel:entries channel="video_tutorials" limit="1" sort="entry_date" order="desc"}

{if count==1}
    <div class="wrapper">
    <div class="video_large">
        <h1><a href="{title_permalink="video_tutorial}">{video_tutorial_title}</a></h1>
        <div class="large_reposition">
        <iframe src="http://player.vimeo.com/video/{video_tutorial_link}?title=0&amp;byline=0&amp;portrait=0" width="900" height="506" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> 
        <h3>{video_tutorial_summary}</h3>
        </div>
    </div>
    </div>
{/if} 
{/exp:channel:entries}


<!-- comments -->

{exp:comment:entries url_title="video_tutorial/comment" sort="asc" limit="100"}
        {comment}
        <p>By {name} on {comment_date format="%Y %m %d"}</p>
{/exp:comment:entries}




<!-- search field -->

<div class="wrapper">
<div class="sidebar">
    <div class="search">
        {exp:search:simple_form form_class="searchbox" channel="video_tutorials"}
            <p>
                 <input type="text" name="keywords" placeholder="Search" id="keywords" value="" size="24" maxlength="100">
             </p>
        {/exp:search:simple_form}
    </div>

    <div class="contact">
        <p> <label for="keywords">Connect & Contact</label> </p>
        <ul id="contact_btns">

            <li>
            <a href= "https://www.facebook.com/pages/Reanimated-Fallout/242045199141877"><img src="images/social_icons/facebook.png"></a>
            </li>

            <li>
            <a href= "https://twitter.com/chrisreanimated"><img src="images/social_icons/twitter.png"></a>
            </li>

            <li>
            <a href= "https://vimeo.com/user10748580"><img src="images/social_icons/vimeo.png"></a>
            </li>

            <li>
            <a href= "http://www.linkedin.com/profile/view?id=46629295&trk=tab_pro"><img src="images/social_icons/linkedin.png"></a>
            </li>

            <li>
            <a href="mailto:chris@reanimatedfallout.com""><img src="images/social_icons/email.png"></a>
            </li>
    </div>

    <div class="donate">
        <p> <label for="keywords">Support</label> </p>

            <ul id="donate_btn">
            <li>
            <a href= "https://twitter.com/chrisreanimated"><img src="images/donate_btn.png"></a>
            </li>
    </div>

    <div class="cosmicrage">
            <a href= "http://cosmicragemotioncomic.wordpress.com"><img src="images/cosmic_rage_web_banner_240_2.png"></a>

    </div>

</div>
</div>

</body>

    <footer>
        <div class="wrapper">
            <div class="footer">
                <p class="footerinfo"> &copy; All content designed and developed by Reanimated Fallout.  </p>
        </div>
        </div>
    </footer>

</html>
2
  • Hey Chris, can you provide us with the code behind your template? – Christopher Kennedy Jan 17 '13 at 23:29
  • thanks. The template that I am working in is designed so there is only one item on it and users will discuss that item. – user1215 Mar 21 '13 at 21:15
4

Your example code shows you doing two things:

  1. Listing any existing comments on the entry ({exp:comment:entries})
  2. Displaying a list of Channel Entries ({exp:channel:entries})

Nowhere are you displaying the comment form (even though you linked to the documentation on it).

However, the comment form is generally meant to be used on a "single entry" template, where the third segment of the URL is an entry_id or url_title of an entry. This is how the comment:entries and comment:form tags know which entry they are display from/submitting to. The code you posted indicates to me that you don't fully grasp how EE's URLs and templates work yet ... I'd suggest reading up on it in the docs.

If you want to display either of these tags on a page which does not contain entry_id or url_title information in the URL, you'll need to provide an entry_id to each tag via their entry_id tag parameter - generally by embedding those chunks of code and passing it via an embed variable.

UPDATE:

These two (simplified - no header or footer HTML) templates should get you started in understanding how it works.

First is your video_tutorial/index template. This provides a listing of your tutorials, each with a link to its "permalink".

{exp:channel:entries channel="video_tutorials" limit="5" paginate="bottom"}
<div class="wrapper">
    <div class="video_large">
        <h1><a href="{title_permalink="video_tutorial/entry"}">{video_tutorial_title}</a></h1>
        <div class="large_reposition">
        <iframe src="http://player.vimeo.com/video/{video_tutorial_link}?title=0&amp;byline=0&amp;portrait=0" width="900" height="506" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> 
        <h3>{video_tutorial_summary}</h3>
        </div>
    </div>
</div>
{paginate}
    <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{/exp:channel:entries}

The next is your video_tutorial/entry template. This is where you'll display all of your entry's data, plus any comments on the entry, and the comment form. Note that the fact that this template is called entry is irrelevant - you can call it anything you want, so long as you change that value in the {title_permalink} path in your index template.

{!-- Display your entry, as this is the "permalink" page for this entry --}

{exp:channel:entries channel="video_tutorials" limit="1" require_entry="yes"}
{if no_results}{redirect="404"}{/if}
<div class="wrapper">
        <div class="video_large">
            <h1>{video_tutorial_title}</h1>
            <div class="large_reposition">
            <iframe src="http://player.vimeo.com/video/{video_tutorial_link}?title=0&amp;byline=0&amp;portrait=0" width="900" height="506" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> 
            <h3>{video_tutorial_summary}</h3>
            </div>
        </div>
    </div>
{/exp:channel:entries}

{!-- Display any existing comments. Note that the reason this works here is that the third segment of the URL this template will be displayed at is the `url_title` for this entry, hence the Comment module knows which comments to look for. --}

<h4>Comments</h4>

{exp:comment:entries channel="video_tutorials" sort="asc" limit="100"}
    {comment}
    <p>By {name} on {comment_date format="%Y %m %d"}</p>
{/exp:comment:entries}

{!-- Display the comment form - same story as above with the `url_title` in the URL. Note that for eah of these tags, you *can* pass either a `url_ttle` or `entry_id` as a parameter if you want to display them in a *non* single-entry template. --}

<h4>Add Your Comment</h4>

{exp:comment:form channel="video_tutorials" preview="video_tutorial/preview"}

    {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><br />
    <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><br />
    <label><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</label><br />
    {if captcha}
            <label for="captcha">Please enter the word you see in the image below:</label><br />
            <p>{captcha}<br />
            <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}
13
  • I added the form code into the template below the viewing comments code and no form displays. The template that I am working in is designed so there is only one item on it and users will discuss that item. – Chris Biewer Jan 18 '13 at 19:17
  • What is the URL structure of the page you're viewing? – Derek Hogue Jan 18 '13 at 19:35
  • reanimatedfallout.com/index.php?/video_tutorial video_tutorial is the template that I have been posting the code for that I would like the comment form and comments in. I have posted up the settings to the comments module as well in a previous post above. – Chris Biewer Jan 18 '13 at 20:12
  • OK, so as I said above, your URL has no entry info in it. That URL indicates a template where you list several tutorials. Each one should link to a "detail" or "view" template (so, instead of {title_permalink="video_tutorial"}, it should be {'title_permalink="video_tutorial/view"}. Then your comment tags should live in the view template. Again, please read the link I posted above form the EE docs explaining how URLs and templates work in EE. – Derek Hogue Jan 18 '13 at 20:20
  • Ok, I created a new template within template group video_tutorial. The new template is named "comment" and the only code in that template is the comment form code. I also went back into the main index and converted the {title_permalink="video_tutorial/comment}. Now that I have done I can see the url is creating unique urls for them however there still is no comment form. I have even tried placing the video_tutorial code in the comment template with no success. Right now when you click on a video it just takes you to a white page. This is my first site and I really appreciate the help on this. – Chris Biewer Jan 19 '13 at 5:45
2

In the control panel check out Admin->channel preferences -> channel -> your channel, edit preferences, and them have a look at the "Comment Posting Preferences" section.

You will also want to make sure comments are turned on in the individual entries. The default for new entries is set earlier in the same control panel page.

3
  • In there I have allow comments:on, require membership:no, enable captcha: yes, require email address: no, moderate comments: no, Max character: 5000, comment resubmission interval:3, comment expiration:0, comment text formatting: XHTML, comment HTML formatting: allow only safe html, allow image urls in comments: no, automatically turn urls and email addresses into links: yes. – Chris Biewer Jan 17 '13 at 23:38
  • 1
    Ok and in the individual entries do you have allow comments for this entry turned on in the options tab? – UltraBob Jan 18 '13 at 0:07
  • I have been testing out with 4 sample videos here are the options under all 4... Channel: video_tutorials Status: Open Make entry sticky: no allow comments: yes – Chris Biewer Jan 18 '13 at 6:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.