On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • @alik, @mrhaw

    Thanks for the help!
    • yes great snippet spoke to soon - dateformat is wonderful! Thank you! Just got so excited forgot to read the details.
      • Hey, Greate snippet, it works great! I just want to control the number of characters to be displayed in [+content+], I want to place it somewhere on my right column. Any help? Thanks. grin
          I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
        • Quote from: labanino at Nov 07, 2010, 10:01 PM

          Hey, Greate snippet, it works great! I just want to control the number of characters to be displayed in [+content+], I want to place it somewhere on my right column. Any help? Thanks. grin


          [+content:notags:word_limit=`55`+]


          word_limit:
          <?php
          $retval = $output;
          $array = explode(" ", $output);
          if (count($array)<=$options)
          {
          $retval = $output;
          }
          else
          {
          array_splice($array,$options);
          $retval = implode(" ", $array);
          }
          return $retval;
          ?>
            palma non sine pulvere
          • The snippet has been updated on Oct 30 -- latest version on my site has required feature for truncation comment’s content built-in. Simply download fresh copy and read explanation on new parameters.
            • Yoohoo! Works great! Just go to line 82:
              $trunc = isset($trunc) && $trunc ? $trunc : 0;

              and change $trunc : number-of-characters;

              Thank you very much! grin
                I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
              • Do not change anything, simply call the snippet as
                [[LatestComments? ... &trunc=`number-of-characters` ...]]
                
                • Oh, cool. Thanks again! grin
                    I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
                  • Hi guys! I’d like to add some .css to the date. Now I have 2010-11-10 but I want something like this:


                    Now I have it like this:
                    <div class="date">[+createdon+]</div>
                    <div class="poster"><a href="[+jcf_website+]">[+jcf_name+]</a> on</div>
                    <div class="link"><h5><a href="[~[+doc_id+]~]">[+doc_pagetitle+]</a></h5></div>
                    


                    and this is the output:

                    Nov-10-2010
                    Default admin account on
                    Post 3


                    Actually my problem is how to add a
                    or something like that to Nov-10-2010

                    $dateFormat = isset($dateFormat) && $dateFormat ? $dateFormat : 'Y-m-d';



                    Thanks. grin
                      I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
                    • You can use just about any characters you please in the formatting string:
                      Unrecognized characters in the format string will be printed as-is.
                      ...
                      You can prevent a recognized character in the format string from being expanded by escaping it with a preceding backslash. If the character with a backslash is already a special sequence, you may need to also escape the backslash.
                      So something like this should work; the CSS in your little block should break the text on the whitespaces nicely:
                      'M j Y'

                      Or this might even work (add more escape backslashes if necessary);
                      'M<b\r />j<b\r />Y'

                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org