Copy link to clipboard
Copied
Hey guys, I was wondering if someone could help talk me out of a slight problem that I'm having with Dreamweaver 2021. Basically, I'm in the process of building my own business website and I'm about halfway through but I'm having a little trouble with a search function on my store page. See, I've got the form objects with the search components functioning correctly however off to the side of that is the section where the main content gets displayed and so what I am trying to achieve is to have the search function button use the keyword text from the search field to do a filename search in the website image directory and have the results displayed in the main content section. If you can help with that, I'd be really happy. Thanks guys.
Copy link to clipboard
Copied
This is how I would do it
Copy link to clipboard
Copied
Without a database being involved you should build an array of image objects in javascript or build an array of image objects in a json file, then search through the array of objects and return any image which contains the search phrase returned from the form field.
Not sure why you'd just want to return an image or images though, if its a store. Normally you'd want to return an image plus some details, unless its just an image gallery you require.
Let me know and I can provide you with some example code if you need to progress this.
Copy link to clipboard
Copied
Before we get totally ahead of ourselves, you're selling images? How many images are you selling?
How likely is it that people will search for the exact filename of an image? Isn't it more likely that they will use generic keywords and phrases to search records in a database to find what they're looking for?
I think we need to know more about what you're doing before we can provide you with meaningful solutions.
In the meantime, Google's Custom Search engine can be programmed to show search results on the same page via an <iframe>. But the search results are actually coming from Google's SERP.
https://programmablesearchengine.google.com/about/