Hi All,
I have jot on a website I’m developing and want to show the following if there are no comments
"This campsite has not yet been reviewed, be the first to review it"
Is this possible ? if not just using jot would it be possible using PHX and if so any pointers would be great because I’ve never used it :’(
Thanks for all responses
You could use a snippet and knock out two birds with one stone
<?php
/* JotDisplay
usage: call the snippet uncached in your document/TV
[!JotDisplay!]
*/
$first_comment_message ='<p><strong>This campsite has not yet been reviewed, be the first to review it!</strong></p>';
$output ='';
// find out how many comments there are for this article
$counter ='[[Jot? &docid=`[*id*]` &action=`count-comments`]]';
// if there are no comments, print the message
if($counter == 0){
$output .= $first_comment_message;
}
// optional: add your Jot call here
$output .='<div id="commentsAnchor">
[[Jot? &customfields=`name,email` &subscribe=`1` &pagination=`4` &badwords=`dotNet` &canmoderate=`Site Admins` ]]
</div>';
return $output;
?>
If I understand you correctly you are calling the snippet in the Jot template, I think you’ll have to use the snippet in the page content itself for it to work correctly.
Hi Breezer
I’m calling the snippet in the page template at the moment as its not possible to add it to the page itself as [*content*] is pulled into another tv so that I can have tabbed content.
Is it possible to add [!JotDisplay!] to another tv ( give it the default value ) and pull that into the page template, have tried it but can’t seem to get it to work.
You might have to modify the part of the snippet that gets the proper Id to conform to whichever way you are combining the comments/pages. In this part of the snippet code:
$counter =’[[Jot? &docid=`[*id*]` &action=`count-comments`]]’;
try changing the [*id*] around, looking at the way you had it in the template (2 post above), using a format like
&docid=`[+jot.html.id+]`
How are you compiling the documents into the tabs?
Maybe try adding qoutes around the 0 in the if() part
if($counter ==
’0
’){
if not maybe try this as the snippet code:
<?php
/* JotDisplay
usage: call the snippet uncached in your document/TV
[!JotDisplay!]
*/
$first_comment_message ='<p><strong>This campsite has not yet been reviewed, be the first to review it!</strong></p>';
$output ='';
// find out how many comments there are for this article
//$counter ='[[Jot? &docid=`[*id*]` &action=`count-comments`]]';
$counter ='[+jot.html.comments+]';
// if there are no comments, print the message
if($counter == '0'){
$output .= $first_comment_message;
}
// optional: add your Jot call here
$output .='[[Jot? &subscribe=`1` &pagination=`10` &moderated=`1` ¬ifyAuthor=`1` &placeholders=`1` &output=`0` &captcha=`1`]]';
return $output;
?>