Latest articles
Latest articles of category




Comments.tpl


comments.tpl and comments-archive.tpl are both related with displaying the comments posted to the relevant article. To submit a comment the user must be logged in.
These files are included inside the article.tpl only when the module is enabled from the administration menu. In order to use the comment system you should have the comment module downloaded and installed into the Guru CMS otherwise you wont be able to see any comment. Installation of the module takes just 3 minutes and can be done from our staff for free if needed.

comments.tpl contains the main layout of the comments form. An example comments.tpl is listed below:
 

Comments.tpl
<form method="post">

<input type="hidden" name="the_hidden_article_id" value="{$id}" />
<strong>{t}Comments{/t}</strong><br />
{if ($login eq '1') or (($forCheckLdap =='1') and ($loginLdap != ''))}
{if $comment_publish eq 'manually'}
<strong><span style="color:#d92705">{t}Please note that your comment will be published after administrator approval{/t}!</span></strong>
{/if}
<pre><textarea name="comments_body" rows="3" cols="50" >{$comments_body}</textarea><br /></pre>
<!--{t}Security Code{/t}: *
       <input id="code" name="code" type="text" />
        {captcha name="captcha" length=6}-->
<input type="checkbox" name="comments_notify" value="yes" /> {t}Notify of follow up comments via email{/t}<br /><br />
<input type="submit" name="submit_comment" value="{t}Submit{/t}" class="formButtonSubmit"/>
<input type="hidden" name="the_hidden_article_id" value="{$id}" />
{/if}

{section name=the_comments loop=$the_comments_id max=10}
    <div class="comment">{$the_comments_username[the_comments]|capitalize}, {t}posted on{/t} <em>{$the_comments_date[the_comments]|date_format:"%d/%m/%y %H:%M:%S"}</em><br /></div>
    <div class="comment-text"><textarea rows="5" cols="50"  readonly>{$the_comments_body[the_comments]}</textarea> <br /><br /></div>
{/section}
{if $count_comments >10}
<br />
<a href="{$smarty.const.WEBSITE_ROOT}/modules/comments/comments-archive.php?article_id={$id}" rel="gb_page_center[700,700]">{t}View archive comments{/t}</a>
{/if}
</form>
{if isset($smarty.post.submit_comment)}
<META HTTP-EQUIV="refresh" content="0;URL=">
{/if}

Tips:

    * This line below is checking which user authentication scheme is been used from Guru CMS. If the Ldap module is bought and enabled via the administration menu, the user is redirected to the relative file, othewise he is logged in via the normal User Authentication procedure.

 {if ($login eq '1') or (($forCheckLdap =='1') and ($loginLdap != ''))}

    * The comments don't apply/show automatically. They should first be approved by the administrator, via the administrator menu.
      If you want to change the comments settings to auto-approved you have to go into the administrator menu -> comments -> comments settings -> and choose: automatically.

{if $comment_publish eq 'manually'}
<strong><span style="color:#d92705">{t}Please note that your comment will be published after administrator approval{/t}!</span></strong>
{/if}

    * If the number of comments is over 10, as we see in the code below, we are directed to the comments-archive.tpl. That file is simply showing all comments in one page for easier browsing. You can simply change the value of 10 with any number you like to adjust accordingly.

      {if $count_comments >10}
      <br />
      <a href="{$smarty.const.WEBSITE_ROOT}/modules/comments/comments-archive.php?article_id={$id}" rel="gb_page_center700,700">
      
      {t}View archive comments{/t}
      </a>
      
      {/if}
Page 2

Posted on: 23/03/2011