Marty Walker Posted October 26, 2015 Share Posted October 26, 2015 Hi all, I'm using the standard search template and I want to have my search results pickup some image tags. I've added the tags option to my images field (portfolio_images). The tags output fine elsewhere but I'm wondering if I'm missing something or if it's even possible at all. <?php $matches = $pages->find("template=portfolio, title|first_name|last_name|body%=$q|portfolio_images.tags*=$q, limit=150"); Link to comment Share on other sites More sharing options...
horst Posted October 26, 2015 Share Posted October 26, 2015 Hi Marty, I'm not sure, but shouldn't it be with a comma, before your image field? $matches = $pages->find("template=portfolio, title|first_name|last_name|body%=$q|portfolio_images.tags*=$q, limit=150"); $matches = $pages->find("template=portfolio, title|first_name|last_name|body%=$q,portfolio_images.tags*=$q, limit=150"); > ! < (Not tested) 1 Link to comment Share on other sites More sharing options...
Marty Walker Posted October 26, 2015 Author Share Posted October 26, 2015 Thanks Horst, I tried that but my search stops working altogether. Link to comment Share on other sites More sharing options...
Macrura Posted October 26, 2015 Share Posted October 26, 2015 i would have tried this first $matches = $pages->find("template=portfolio, title|first_name|last_name|body|portfolio_images.tags*=$q, limit=150"); but if that didn't work then maybe or groups: $matches = $pages->find("template=portfolio, (title|first_name|last_name|body%=$q), (portfolio_images.tags*=$q), limit=150"); 1 Link to comment Share on other sites More sharing options...
Marty Walker Posted October 27, 2015 Author Share Posted October 27, 2015 Thanks Marc, No go with either of those two too. Now wondering if it's a CroppableImage issue. Link to comment Share on other sites More sharing options...
adrian Posted October 27, 2015 Share Posted October 27, 2015 I just tested Macrura's group approach and it works for me on an ImageExtra field. It's modified slightly to match the fields/templates I have in my current sandbox install. I can't imagine why CroppableImage would affect this. $q = 'testtag'; $matches = $pages->find("template=home, (title|first_name|body%=$q), (images.tags*=$q), limit=150"); foreach($matches as $p) { echo $p->title; } What happens if you strip it down to the basics, like this: $q = 'testtag'; $matches = $pages->find("images.tags~=$q, limit=150"); foreach($matches as $p) { echo $p->title; } Also, try putting this as is in a template file to make sure nothing is going wrong in getting $q to the selector. Of course you could also just echo the value of $q in your search template as well, but you see where I am headed 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now