We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12151
    • 115 Posts
    hi there ...

    i’m using Jot (1.1.2) to gather customer testimonials, which is working perfectly with moderation, notification, etc. however i need to be able to show a random "comment" on the homepage. is it possible to have Jot display one random comment?

    many thanks smiley
      • 12151
      • 115 Posts
      if anyone is interested i solved this problem with the following snippet. it’s probably not the most efficient way of doing it but i’m fairly new to PHP and i don’t know the inner workings of MODx well yet.

      anyways ...

      <?php
      $rsContent = $modx->db->select("id,content", "modx_jot_content", "published=1", "RAND()", "1");
      $arr = mysql_fetch_array($rsContent);
      $id = $arr['id'];
      $content = $arr['content'];
      
      $rsFields = $modx->db->select("content", "modx_jot_fields", "label='name' AND id=".$id);
      $arr = mysql_fetch_array($rsFields);
      $name = $arr['content'];
      
      $rsFields = $modx->db->select("content", "modx_jot_fields", "label='location' AND id=".$id);
      $arr = mysql_fetch_array($rsFields);
      $location = $arr['content'];
      
      $strReturn = "<div id='TestimonialHighlightCopy'>".$content."</div><div id='TestimonialHighlightCredit'>- ".$name.", ".$location."</div>";
      
      return $strReturn;
      ?>
        • 36772
        • 2 Posts
        Hello. It's great, but can you explain how to use it^^. I need to be able to show two last comments on the homepage.
        Thank you very much.
          • 36772
          • 2 Posts
          I did it ^^

          [!Jot? &tplForm=`myTmp` &docid=`8` &sortby=`createdon:a` &numdir=`0` &placeholders=`1` &output=`0` &pagination=`2`!]

          [+jot.html.comments+]
            • 20413
            • 2,877 Posts
            Awesome snippet that comes handy for me 5 years later! laugh
              @hawproductions | http://mrhaw.com/

              Infograph: MODX Advanced Install in 7 steps:
              http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

              Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
              http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower