I’m working on building a more user-friendly frontend access page in WordPress for a content library built on ContentDM (http://www.oclc.org/support/questions/contentdm/default.htm). One of the things that was requested as part of the site was a search form that instead of searching WordPress, goes to the ContentDM library and searches there.
It appears that the search syntax for ContentDM is as follows:
http://libraryID.contentdm.oclc.org/cdm/search/searchterm/INPUT_TERM/order/nosort
With “INPUT_TERM” being whatever the user searched for.
In other words, in order to create a search form that went directly there, I’d have to dynamically insert the contents of the input element into the middle of the “action” attribute of the form.
I’m guessing my best bet is to just send it to a PHP page that sticks $_POST[‘whatever’] into the URL and does a redirect. But is there in fact a way to do it dynamically from the form (ideally without Javascript) and save a step?
Thanks!
I guess something like this could work:
This will redirect the browser to the search page given in the search box, however it’s not terribly reliable.
You might want to see if there’s a query string “version” of the URL – maybe that search URL is affected by mod_rewrite to “look pretty”, and you might be able to have
http://libraryID.contentdm.oclc.org/cdm/searchas the action, and have the input field namedsearchterm: