We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22840
    • 1,572 Posts
    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
      • 4041
      • 788 Posts
      You could use a snippet and knock out two birds with one stone smiley

      <?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;
      ?>
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 22840
        • 1,572 Posts
        Thanks for the reply.

        Im using the following in my snippet:

        <?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 .='[[Jot? &subscribe=`1` &pagination=`10` &moderated=`1` &notifyAuthor=`1` &placeholders=`1` &output=`0` &captcha=`1`]]';
        
        return $output;
        ?>


        and the following in my template:
        <h2>Customer Reviews</h2>
        [!JotDisplay!]
        
        
        [+jot.html.comments+] <!-- Second. places the comment of the page-->
        <p> </p>
        		[+jot.html.form+] <!-- First. places the form on the page -->
        <br />
        
        [+jot.html.navigation+]
        


        Jot workes as expected but still displayes the message even if there is a comment.

        Any pointers would be great
          • 4041
          • 788 Posts
          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.
            xforum
            http://frsbuilders.net (under construction) forum for evolution
            • 22840
            • 1,572 Posts
            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.
              • 22840
              • 1,572 Posts
              Ok have tried adding it to the content area and pulling it into the page template via [*content*] but it’s still returning the same thing.

              would love to be able to get this working sad
                • 4041
                • 788 Posts
                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?
                  xforum
                  http://frsbuilders.net (under construction) forum for evolution
                  • 22840
                  • 1,572 Posts
                  Hi Breezer,

                  Thanks for trying this.

                  I’ve tried the following for the id but none seem to resolve it.

                  [+jot.html.id+]
                  [~[+id+]~]
                  [+[~id~]+]
                  [~id~]
                  [+id+]
                  [*id*]

                  For the tabs I’m using jquerie

                  http://flowplayer.org/tools/demos/tabs/index.html

                  If i alter the snippet counting bit and output the count it displays the correct number of comments so it is counting correctly

                  $counter =’[[Jot? &docid=`[*id*]` &action=`count-comments`]]’;
                  $output .=$counter;

                  Displays 1

                  I have also taken out all the scripts and links to then and it’s still the same so we can eliminate a conflict anywhere huh
                    • 4041
                    • 788 Posts
                    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` &notifyAuthor=`1` &placeholders=`1` &output=`0` &captcha=`1`]]';
                    
                    return $output;
                    ?>
                      xforum
                      http://frsbuilders.net (under construction) forum for evolution
                      • 22840
                      • 1,572 Posts
                      Hi Breeze,

                      Really appreciate your help on this

                      Tried by using ’0’ and it stopped the message being displayed completely, also tried the new snippet call and exacley the same results IE displays the message with or without comments with the quotes removed from the 0 and with the quotes on stops the message completely. huh

                      This is driving me nuts because looking at the code it should work but it seems like the count result isn’t being passed so therefore always resulting with 0
                      embarrassed