We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    That's MODx, Evo or Revo, it's all MODular and eXtensible. The possibilities are only limited by the imagination. MODx makes it so easy to basically forget the storage of the data, and think about all the different ways for input and display.

    For example, I'm working at the moment on a site that has a page for downloading support files for various products. This page currently consists of a set of tabs, with each tab having a three-way chained drop-down select. In the first select, you choose the product family. This triggers loading the second select with a set of products. Selecting the product will load a list of files for download in the third select. All of this is managed by editing some really ugly Javascript in a separate chunk for each group of select options. This editing of these chunks has to be done every time a new product is added, with its supporting files. Very nasty. And the resulting page has a long stretch of blocks of javascript with embedded text and links. Gave me a headache just trying to figure out what in the world it was doing.

    I've kept the outermost tabbed interface, although using JQuery UI makes it much easier and a lot prettier. But instead of chained select drop-downs and a lot of Javascript, fed by a whole bunch of ugly hand-coded Javascript-laden chunks, I'm using sets of simple unordered lists, fed by MIGx (Multi-grid custom TVs) TVs nicely organized in the Template Variables tab of the resource itself. The unordered list is easily styled by CSS, and needs no Javascript at all; it works just like a fancy Wayfinder menu. Much better for the end user, and infinitely better for the editors who have to input new product data.
      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
      • 40447
      • 165 Posts
      For anyone who is interested, this is my first step in making the php sorting script.
      <?php
      $a = $modx->runSnippet("getField", array("docid" => '5', "field" => 'content'));
      $b = "from";
      $c = "to";
      
      function GetBetween($mystring,$start,$end){
          $r = explode($start, $mystring);
          if (isset($r[1])){
              $r = explode($end, $r[1]);
              return $r[0];
          }
          return '';
      }
      
      $output = GetBetween($a,$b,$c);
      echo $output;
      ?>


      Resource page with id=5 holds following text only for checking the script: (without quotes and could be any text)
      "This is a bunch of text inside a frontend resource page from which we want to extract specific text parts to pull into backend placeholders."
      $output = which we want

      Here is where I found all the inspiration:
      http://stackoverflow.com/questions/6410942/php-get-between-function-improvement-add-array-support
      http://php.net/manual/en/function.echo.php
      http://www.w3schools.com/php/php_functions.asp

      [ed. note: sitecms last edited this post 13 years, 8 months ago.]