We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34017
    • 898 Posts
    This is is a modified version of HyperFlexSeachForm. It is modified to search the table of your choosing.


    This is 0.1 alpha. I made it about 6months ago and just put together an idea for others to use/modify. Maybe we can make it fully functional and a good snippet.

    This snippet call should be protected with Admin user status OR on tables that can have all columns searched. BECAUSE it does not have exclude column abilities right now (if you use webuser_attributes, someone can see all MD5 passwords).


    Snippet Call:
    Snippet Name: CRUDx_search
    $snipPath = $modx->config['base_path'] . "assets/snippets/CRUDx_search/";
    require_once $snipPath."CRUDx_search.php";
    



    Default Placeholders:
    [+resultsFoundText+]
    [+currentPage+]
    [+resultsFoundText+]
    [+totalPages+]
    [+searchPagination+]
    [+nextLink+]
    [+searchWarning+]
    [+searchResultsText+]
    [+openForm+]
    [+searchBox+]
    [+submitButton+]
    [+closeForm+]
    [+fullform+]
    


    The Results are parsed through a chunk. The default chunk is: CRUDx_search_results.

    My example page is:
    [[CRUDx_search]]
    
    [+openForm+]
    <fieldset><legend>Search</legend>
    [+searchBox+]
    <select name="searchColumn">
    	<option value="fullname">Home Area Code</option>
    	<option value="email">Work Area Code</option>
    	<option value="phone">Cell Area Code</option>
    	<option value="mobilephone">First Name</option>
    	<option value="blocked">Last Name</option>
    	<option value="dob">Address</option>
    	<option value="gender">City</option>
    	<option value="country">State</option>
    	<option value="state">Zipcode</option>
    	<option value="zip">Resume Text</option>
    	<option value="fax">Resume File Name</option>
    	<option value="all_fields">Search all Fields</option>
    </select>
    [+submitButton+]
    </fieldset>
    </form>
    <br/>
    <p class="introMessage">[+searchResultsText+]</p>
    
    <div class="search_results">
    <span class="search_previous">[+previousLink+]</span> [+searchPagination+] <span class="search_next">[+nextLink+]</span>
    </div>
    
    <div class="results">
    	[+searchResults+]
    </div>
    
    
    <div class="search_results">
    [+previousLink+] | [+searchPagination+] | [+nextLink+]
    </div>
    
    <br/><br/>
    <p class="searchErrors">[+searchWarning+]</p>
    <p class="searchErrors">[+searchFailure+]</p>
    



    My example chunk: CRUDx_search_results
    <h2>[+fullname+]</h2>
    [+email+] <br/>
    [+phone+] <br/>
    [+fax+] <br/>
    [+mobilephone+] <br/>
    [+blocked+] <br/>
    [+dob+] <br/>
    [+gender+] <br/>
    [+state+], [+zip+] [+country+]<br/>
    
      Chuck the Trukk
      ProWebscape.com :: Nashville-WebDesign.com
      - - - - - - - -
      What are TV's? Here's some info below.
      http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
      http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
      • 867
      • 241 Posts

      loopDBChunk 1.0 + CrudX Search ? grin

      Would it be a way to facilitate query for let’s say a table of links (+infos) ?

      the idea is for exemple a little form with selected + check ==> results from the table
      ;D
        • 34017
        • 898 Posts
        I dont think I understood you alchime.
          Chuck the Trukk
          ProWebscape.com :: Nashville-WebDesign.com
          - - - - - - - -
          What are TV's? Here's some info below.
          http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
          http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
          • 867
          • 241 Posts

          Ok sorry for the telegraph way of writting.

          I was wondering if with CRUDx_search I could set up a form that would
          display a select (or two) with all the value of a field and use Crudx to make the search and show the result
          matching the argument value selected

          Crudx would make a select a bit like that :

          $lieux = (isset($lieux))? $lieux : ’’; // from the fist select
          $rubriques = (isset($rubriques))? $rubriques : ’’; // eventualy from the fist select

          $sql = $modx->dbQuery(’select * from ’.$modx->getFullTableName(’favorite_links’). ’ where lieux = "’ . $lieux . ’" and rubriques = "’. $rubriques .’" ’);

          Hope i’m easy to understand now smiley
            • 34017
            • 898 Posts
            I think it can only take either one column to search against or all of them in a table. It’s a customized version of HyperFlexSearch.

            It would probably be best to use TVexplorer for what you want to do.
              Chuck the Trukk
              ProWebscape.com :: Nashville-WebDesign.com
              - - - - - - - -
              What are TV's? Here's some info below.
              http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
              http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008