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 not showing up.

January 19, 2008 8:45pm

Subscribe [1]
  • #1 / Jan 19, 2008 8:45pm

    joshmarch

    14 posts

    I’m linking to my weblog page using:

    <li id="weblog"><a href="http://{path=web/blog}">Weblog</a></li>

    The most recent post appears but the comment form does not.  The comment form DOES, however, show up when linking directly to a specific weblog entry.  What am I missing?

    Thanks!

    Mod Edit: Moved to the Technical Support forum.

  • #2 / Jan 20, 2008 10:17am

    Robin Sowell

    13255 posts

    The comment form tag will only work on an EE ‘single entry page’- meaning a page with the url_title or entry_id in the url (same deal for the comments tag- unless it’s just showing the ‘latest comments’).

    That’s why it’s not showing when linking with the path global- no single entry indicator in the url.  You can force it to show via the entry_id parameter, but the form is really meant for single entry pages.

  • #3 / Jan 20, 2008 2:28pm

    joshmarch

    14 posts

    Ahh.. thanks Robin.  That makes total sense.

    My blog page is setup to just show the most recent post.  So what’s the best way to get the comment form to show when someone clicks on this page without having to hard code the entry_id every time I post a new entry?

  • #4 / Jan 21, 2008 12:07pm

    Robin Sowell

    13255 posts

    Let’s shift this to ‘How to’ as it will take some creativity.

    And then- what happens if you turn php ‘on’ in the main template and inside the weblog tag, set:

    {exp:weblog:entries}
    <?php $id = '{entry_id}'; ?>
    {/exp:weblog:entries}
    {embed="site/comment" id="<?php $id; ?>"}

    Then create a site/comment template with just the comment form on it- and hard code the entry_id parameter- using the embed variable {embed:id}

    Note sure this will work- it’s going to depend on how parse order shakes out.  Would need to be parsed on output- and I’m not dead sure it will be defined for the embed.  But- that’s the first thing to try.  Might work nesting the form inside the weblog tag- where the {entry_id} variable would be available.  But nesting like that tends to lead to variable conflicts- so that’s problematic as well.

    Worst case scenario, do a query to get the latest entry id.  But basically?  You need that entry_id so you can hard code it in the form parameter. 

    Make sense?

  • #5 / Jan 21, 2008 3:58pm

    joshmarch

    14 posts

    Thanks Robin.  I played a little bit with what you suggested, but I’m really limited in php.  I did however stumble across a very simple way of getting it to work.  I just added these EE tags around my primary navigation links:

    {exp:weblog:entries weblog="articles" orderby="date" limit="1"}
    <li id="home"><a href="http://{path=web/index}">Home</a></li>
    <li id="work"><a href="http://{path=web/work}">Work</a></li>
    <li id="about"><a href="http://{path=web/about}">About</a></li>
    <li id="weblog"><a href="http://{title_permalink=">Weblog</a></li>
    <li id="contact"><a href="http://">Contact</a></li>
    {/exp:weblog:entries}

    Now the ‘blog’ link has the entry_id info it needed to include the comments and form.  Not sure if this is the most efficient way of getting around this, but works for me.  Thanks for your help.

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

ExpressionEngine News!

#eecms, #events, #releases