We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37165
    • 89 Posts
    I'm just looking to make a simple front-end search for my migxdb. Nothing fancy just want to search by keyword. I used bloX to do it a year or so ago, but that method isn't working anymore. I don't see any documentation for bloX, so wondering if there is another way or a good tutorial to follow?
      • 4172
      • 5,888 Posts
      bloX should still work, doesn't it?

      otherwise, you can simply use something like:

      [[!migxLoopCollection?
      &packageName=`yourPackage`
      &classname=`yourClass`
      &tpl=`searchTpl`
      &where=`{"content:LIKE":"%[[!getReqParam? &name=`search`]]%"}`
      ]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 37165
        • 89 Posts
        I think I'm missing a step here. With both this solution above and the bloX solution I was using, I'm getting a list from my migxdb, but it's just giving me a list of entires. It's not actually searching them. My actual search chunk is on this page, but also appears on other pages. My chunk looks like this:

        			<form id="search" action="[[~49]]" method="get" name="search">
        
        				<input type="text" class="focusHere" name="keywords" value="[[+keywords]]" />
        				
        				<input type="submit" value="Search" name="search"/>
        			</form>


        Resource 49 is where I want the results, I put this code in:

        			<div class="artRow">
        				
        					[[!migxLoopCollection?
        				 &packageName=`artGallery`
        				&classname=`artGallery`
        				 &tpl=`galleryTemplateSm`
        				&where=`{"content:LIKE":"%[[!getReqParam?
        				&name=`keywords`]]%"}`
        					]]
        
        			</div>

          • 4172
          • 5,888 Posts
          the getReqParam - snippet is installed?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 4172
            • 5,888 Posts
            and you need to change the field, where you want to search

            &where=`{"content:LIKE":"%[[!getReqParam? &name=`keywords`]]%"}`
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 37165
              • 89 Posts
              Thanks again Bruno. Your solution was right. I didn't realize getReqParam was a package. I also didn't realize that I needed to change the "content" to one of my MIGXDB fields. Once I did those two things it worked great!

              This was the final line I used.

              	&where=`{"title:LIKE":"%[[!getReqParam? &name=`keyword`]]%"}`
              
              


              This was really helpful to me. I figured out a few other things too