On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • 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
    • 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 ...

      $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;
      • 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.
        • I did it ^^

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

          • Awesome snippet that comes handy for me 5 years later! laugh
              @hawproductions | http://mrhaw.com/

              Infograph: MODX Advanced Install in 7 steps:

              Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower