We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27305
    • 173 Posts
    I also get the lag with headline replacement, I’m using ff on windows. Looks nice.
      I made my first site with modx
      ------------------------
      Shopping blog
      Sky+ HD
      • 5340
      • 1,624 Posts
      I think I fixed the right hand gallery. I just turned off cashing for the whole page. I’m not sure what was happening

      I also fixed the replacement of the title with text. The title is only shown at the end.

      Let me know how it feels.

      Thx for the input.
        • 26931
        • 2,314 Posts
        Hi there,

        nice site!
        yes, the thumbnail gallery now shows up on the first page. FF2 Win XP Sp2.

        btw, how did you manage the dealer search, the values of the second dropdown in relation to what was chosen in the first?

        cheers, j
          • 5340
          • 1,624 Posts
          Actually there is no relation. I just use classes

          <div class="dealer New-Jersey Brooklawn" style="display: block;">
          <h3>
          </h3>
          <div class="info">Rt. 130 at Brooklawn Circle, Brooklawn, NJ, 08030 Phone: 856-456-4777   Fax: 856-456-4777</div>
          </div>


          The classes are generated from TVs. Each dealer has a TV for State and one for City

          the ditto call is <div class="dealerSearch"><div class="scroll-pane">[[Ditto? &tpl=`dittoTplDealer`]]</div></div>

          the js can be found in the source. I used jquery

          the ditto tpl is
          <div class="dealer [+ProvinceState:safeClass+] [+RegionCity:safeClass+]">
          <h3>[+pagetitle+] [+Website:makeWebsite+] [+Email:makeEmail+]</h3>
          <div class="info">[+Address+] Phone: [+Phone+] [+Fax:makeFax+]</div>
          </div>

          - safeClass is a Phx custom snippet than creates a safe class name
          - makeWebsite just checks if there is a value in the website TV and displays it if necessary

          Then you just use your favorite javascript framework or plain javascript to show/hide div’s


            • 26931
            • 2,314 Posts
            thank you! j
              • 5340
              • 1,624 Posts
              Also here’s how I create the array for the dropdown list

              $provinceCity = array();
              $list = "";
              $id= $modx->documentObject['id'];
              $title= $modx->documentObject['pagetitle'];
              $ids = $modx->getActiveChildren($id,'menuindex','','id');
              //var_dump($ids);
              foreach($ids as $id){
                 //echo $id['id'];
                  $tvs = $modx->getTemplateVarOutput(array("ProvinceState","RegionCity"),$id['id']);
                  
                  //clean values using a snippet
                  
                  $tvs['ProvinceState'] =  $modx->runSnippet("safeName",array("txt" => $tvs['ProvinceState']));
                  $tvs['RegionCity'] =  $modx->runSnippet("safeName",array("txt" => $tvs['RegionCity']));
                  
                  //put values in arrays. Only unique values should exist
                  if(!array_key_exists($tvs['ProvinceState'], $provinceCity)){
                      $provinceCity[$tvs['ProvinceState']] = array();
                      array_push($provinceCity[$tvs['ProvinceState']],$tvs['RegionCity']);
                  }else{
                      if(!in_array($tvs['RegionCity'], $provinceCity[$tvs['ProvinceState']])){
                          array_push($provinceCity[$tvs['ProvinceState']],$tvs['RegionCity']);
                      }
                  }
              }
              
              //make list to be used as select values
              foreach($provinceCity as $key=>$val){
                  $list .= 'list["' . $key . '"]=\'';
                  $list .= '<option value="">Select Region/City</option>';
                  foreach($val as $city){
                       $list .= '<option value="'.$city.'">'.$city.'</option>';
                  }
                  
                  $list .='\';';//close list
              }
              
              echo $list;


              I guess this is the most important part. To extract the Province/State and Region/City from the TVs and create unique array/arrays