1

Hi I need help with searching assets image data via the front end of my site. I have a single entry for a page with an assets field powered gallery on it.

The multiple images for the gallery are added via an assets field and pulled into my template with an assets tag pair e.g.

{page-gallery} content {/page-gallery}

Is it possible to do a search on assets meta for the content within the tag pair ?

My goal is to create a simple image library that can searched on assets meta content.

e.g. {page-gallery:title}

Is this possible ?

1

Assets has field tag parameters that correspond with each of its metadata fields (see http://docs.pixelandtonic.com/assets/templating/field.html).

If you pass your ‘title’ search input as POST data on the page, you can fetch that value and pass it into Assets’ title param using the GET/POST Parameters add-on like so:

{page-gallery title="{exp:parameters post='asset_title'}"}
    ...
{/page-gallery}
| improve this answer | |
  • [porvair-sciences.com/search/image-search] .. seems to generate the right output but something strange is happening. – Richard Sep 16 '13 at 13:38
  • I used '{exp:channel:entries} {page-gallery title="{exp:parameters:post name="title"}"} {title} {/page-gallery} {/exp:channel:entries}' – Richard Sep 16 '13 at 13:39
  • But the image seems to jump out of place and fail. If however I hardcode the {page-gallery title="204003"} it works as expected. – Richard Sep 16 '13 at 13:41
  • Any help is massively appreciated ta. – Richard Sep 16 '13 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.