We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29843
    • 9 Posts
    • Are you trying to highlight what options are selected and then highlighting the specific text?

      If that's the case its just a case of making a php snippet, chcecking for the various get vars, and then allocating a css state to those that are there.

      A quick example - you might want to make vars more relevant, and if you're dealing with lots... a switch statement might be more appropriate.

      PHP
      if ($_GET['type'] == 'Apartment') {
      	$apartmentType = "active";	
      }
      
      echo '<p class="' . $apartmentType . '">Apartment</p>';


      CSS
      p {color:blue;}
      p.active {color:yellow}
        GEL STUDIOS
        MODX Professional | MODX Ambassador

        Website | Email | Twitter | Facebook
        • 29843
        • 9 Posts
        I want to filter the output by clicking on the classifications district contains the field like Apartment, Putuo and so on which behind "Type" and "District" .
        • That site does it by rendering data from a database and then comparing them against various get variables. MODX has xpdo.

          I suggest you take a read of the documentation http://rtfm.modx.com/display/xPDO20/xPDOQuery.where
            GEL STUDIOS
            MODX Professional | MODX Ambassador

            Website | Email | Twitter | Facebook
          • This is more php coding relevant than modx doing itself.
            For your problem, the ajax way comes in my mind. I suppose you have a good php exp and basic javascript to work on jquery for sending request to MODx resource (eg: processAjax). And this processAjax resource will include the snippet which you have to write your own. For easier developing, you can use the source file for this snippet, so you can work it outside than edit it in the web manager.
            So, what this snippet does, you ask:
            - use $_REQUEST[] to get variables for filtering
            - pass variables to xPDO.Where query to filter out data
            - return the data to view by directly echo (bad way), and $modx->toPlaceholder(array,prefix) (better way, docs on: http://rtfm.modx.com/display/revolution20/modX.toPlaceholders). The latter will create some placeholder eg: [[+tv.name]], etc, then you can place them to a template chunk, and render them all before return the result.
            OR, you directly render your data as json data and work on javascript to render the data.

            Things to consider:
            - paging
            - is category, district,etc dynamic? If yes, you should write a snippet which gonna do $modx->getObject(name,query——array) to get the data and $modx->toPlaceholder() to pass it to placeholders. Use those placeholders to decorate your search page.
            • Can be solved with TVs.

              1. typeTV
                input option: listbox (single-select)
                input option values: Apartment||Villa||Old House
              2. districtTV
                input option: listbox (single-select)
                input option values: (list of district)
              3. bedroomTV
                input option: listbox (single-select)
                input option values: 1Br||2Br||3Br||4Br....
              4. sizeTV
                input option: number
                allow blank: no
                allow negatif: no
                allow decimal: no
              5. priceTV
                input option: number
                allow blank: no
                allow negatif: no
                allow decimal: ?
              6. anotherTV if required?

              Then use getResources snippet to query your resources. You can use getResources to query TVs.
                zaenal.lokamaya
              • You can also use an auto-tag TV for such things as "bedrooms".
                  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
                  • 29843
                  • 9 Posts
                  It seems that I want to upgrade my program to 2. XX version, otherwise getResources can't use
                  Thanks



                  Quote from: lokamaya at Dec 11, 2012, 09:14 AM
                  Can be solved with TVs.

                  1. typeTV
                    input option: listbox (single-select)
                    input option values: Apartment||Villa||Old House
                  2. districtTV
                    input option: listbox (single-select)
                    input option values: (list of district)
                  3. bedroomTV
                    input option: listbox (single-select)
                    input option values: 1Br||2Br||3Br||4Br....
                  4. sizeTV
                    input option: number
                    allow blank: no
                    allow negatif: no
                    allow decimal: no
                  5. priceTV
                    input option: number
                    allow blank: no
                    allow negatif: no
                    allow decimal: ?
                  6. anotherTV if required?

                  Then use getResources snippet to query your resources. You can use getResources to query TVs.
                    • 29843
                    • 9 Posts
                    “auto-tag TV”?I do not quite understand

                    Quote from: sottwell at Dec 11, 2012, 12:38 PM
                    You can also use an auto-tag TV for such things as "bedrooms".
                      • zaenal.lokamaya