Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi,

Really enjoying using Couch, it has made developing site very quick and its very intuitive. I have stumble across a bit of a problem though and I can't seem to find any reference to it in the docs.

I'm trying to output a list of comments for a given article, this is all working fine until I try to paginate them. It seems that if I set the limit to higher than the number of submitted comments it is refusing to output any at all.

here is the code I am using to output my comments:

Code: Select all
<div >
   <h4><cms:show k_comments_count /> Comments added</h4>
   <cms:if k_comments_count>
   <ol>
      <cms:comments page_id=k_page_id limit='20' order='asc' paginate='1'>
      <li>
         <div>
            <cms:gravatar email="<cms:show k_comment_author_email />" size="71" />
            <a name="<cms:show k_comment_author_anchor />">
         </div>
         <div>
            <div>
               <span><cms:show k_comment_author /></span>
               <span><cms:date k_comment_date format='F j, Y' /></span>
            </div>
            <div>
               <cms:show k_comment />
            </div>
         </div>
      </li>
   </ol>
   </cms:if>

   <cms:if k_paginated_bottom>
      <div class="tf_resources_pagination clearfix">
         <cms:if k_paginate_link_prev>
            <a href="<cms:show k_paginate_link_prev />">&lt; Previous Comments</a>
         </cms:if>
         <cms:if k_paginate_link_next>
            <a href="<cms:show k_paginate_link_next />">Next Comments &gt;</a>
         </cms:if>
      </div>
   </cms:if>

   </cms:comments>
</div>

<cms:else />
No Comments
</cms:if>


I'm still fairly new to couch so i'm not sure if I have my nesting of the <cms> tags quite right. Any help would be greatly appreciated.
Hello and welcome to our forums :)
I am glad you found Couch useful.

As for the problem you mentioned, I copy/pasted your code to test it out and it gave me a syntax error ('if' not closed) - so perhaps you missed out some code while selecting.

Anyways, I made some minor modifications to your code and it is working fine now. Here it is -
Code: Select all
<div >
   <h4><cms:show k_comments_count /> Comments added</h4>
   
   <cms:if k_comments_count>
   <ol>
      <cms:comments page_id=k_page_id limit='20' order='asc' paginate='1'>
      <li>
         <div>
            <cms:gravatar email="<cms:show k_comment_author_email />" size="71" />
            <a name="<cms:show k_comment_author_anchor />">
         </div>
         
         <div>
            <div>
               <span><cms:show k_comment_author /></span>
               <span><cms:date k_comment_date format='F j, Y' /></span>
            </div>
            <div>
               <cms:show k_comment />
            </div>
         </div>
         
        <cms:if k_paginated_bottom>
            <div class="tf_resources_pagination clearfix">
                <cms:if k_paginate_link_prev>
                    <a href="<cms:show k_paginate_link_prev />">&lt; Previous Comments</a>
                </cms:if>
               
                <cms:if k_paginate_link_next>
                    <a href="<cms:show k_paginate_link_next />">Next Comments &gt;</a>
                </cms:if>
            </div>
        </cms:if>
         
      </li>
      </cms:comments>
   </ol>
   <cms:else />
        No Comments
   </cms:if>
</div>

Hope this helps. Please let us know.
Thanks.
Thanks for taking the time to look at this for me and sorry for my late reply. It appeared that during the testing of the pagination I hadn't checked the URL and it was still amended for the second page, hence why nothing was showing up when I upped the limit.

All sorted now!

I do have one requirement for the website which I cannot find in the documentation and Instead of creating a new topic I thought I may as well ask here. Is it possible for users to register via a form on the website and be granted the lowest level of permissions? I can't seem to find anything in the documentation to reflect this.

Cheers.
3 posts Page 1 of 1
cron