<![CDATA[ "No comments yet" notice for Comments placeholder? - MODX Community Forums]]> https://forums.modx.com/thread/?thread=43210 <![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder?page=2#dis-post-249427
I’ve tried this code but it doesn’t work. I’ve placed a call on a page I know has comments, but it returns the ’No comments’ chunk instead.

Debugging shows that $count is coming out as zero inside the snippet code.

I’ve tried running the snippet call cached and un-cached. Neither works.

Help!]]>
nicksayers Jun 30, 2011, 10:09 AM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder?page=2#dis-post-249427
<![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249426 - just what I needed!]]> lokust Jul 19, 2010, 12:13 PM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249426 <![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249425 ]]> mrhaw Aug 03, 2009, 06:34 PM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249425 <![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249424
<?php
/* 
 JotExtNoComments Snippet written by http://setpro.net.pl/
 Parameters:
   id -> id of the document that Jot is bind to (default: current document)
   jotChunk -> chunk that will be used for calling Jot when the document already has comments (required)
   jotChunkNoComments -> chunk that will be used for calling Jot when the document has no comments so far (required)
 Example:
   [[JotExtNoComments? &jotChunk=`Comments` &jotChunkNoComments=`NoComments`]]
*/
$jotChunk = isset($jotChunk) && $jotChunk ? $jotChunk : '<p class="error">You forgot to pass a chunk for calling Jot.</p>';
$jotChunkNoComments = isset($jotChunkNoComments) && $jotChunkNoComments ? $jotChunkNoComments : '<p class="error">You forgot to pass a chunk for calling Jot (no comments variant).</p>';
$jot_params = array(
  'action' => 'count-comments',
  'id' => (isset($id) && $id ? $id : $modx->documentObject['id'])
);
$count = $modx->runSnippet('Jot', $jot_params);
return $count ? $modx->getChunk($jotChunk) : $modx->getChunk($jotChunkNoComments);
?>

If you remove my comments it will appear that it has just several lines of code, but this code will for sure survive possible upgrade with no further efforts. Tested.]]>
Alik Aug 03, 2009, 04:30 PM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249424
<![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249423 sunchess Aug 03, 2009, 03:49 AM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249423 <![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249422 beefknuckle Aug 04, 2008, 12:45 PM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249422 <![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249421
I see a feature request? laugh]]>
fruitwerks Aug 04, 2008, 12:31 PM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249421
<![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249420 sottwell Aug 04, 2008, 11:57 AM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249420 <![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249419
Thanks,

Aaron]]>
beefknuckle Aug 04, 2008, 11:54 AM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249419
<![CDATA[Re: &quot;No comments yet&quot; notice for Comments placeholder?]]> https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249418 ]]> fruitwerks Aug 03, 2008, 04:18 PM https://forums.modx.com/thread/43210/no-comments-yet-notice-for-comments-placeholder#dis-post-249418