Hi. I'm not sure if I'm asking a really stupid question but if I do please bare with me.

I have a Flash front-end for my site where the user can enter a keyword search query. I'd like to pass this query to Drupal to perform a search on the content and return an XML formatted result back to Flash.

What would be the best way to go about this?

Any help very much appreciated.

Thanks
Luke

Comments

mm167’s picture

write a call back ..

pan69’s picture

Gee, thanks that was really helpful... not...

mm167’s picture

like question like answer ....ha ha

pan69’s picture

Mate. If you don't have anything constructive to contribute, maybe you shouldn't be hanging out here.

pan69’s picture

No one has anything "sensible" to say about this?

Any help much appreciated.

Thanks
Luke

Brad Beattie’s picture

Hrm... Well, the database is accessible, yeah? I haven't worked with flash much, but does it have any kind of MySQL connector? If so, you could bypass Drupal's PHP entirely.

pan69’s picture

Hi. Thanks for your comment. In a worst case scenario I could do that. However, I don't think that is 'the drupal way' of doing things. I know I need to write hooks and all that, no problem there either. I just need a document, tutorial or something else that points me in the right direction to actually achieve this.

mm167’s picture

I have told him to use callback, but he think that's "NOT sensible". ...what can i say?

basically flash cant connect directly to the db. even flash can, it is NOT the right way, since the db should be hidden under (or protected by) the drupal.

a. flash make a call to the callback
b. callback function get the data from db and return the result to the flash
c. flash got the result and present the data

that's it.

Is this "NOT sensible"?

edited: I nearly forget there's another option:
drupal callback <----> JS<->flash

pan69’s picture

Mate, I've never said that a callback is not sensible. I will forgive your disability to read English.

What you call a callback is called an a-synchronize call by programmers. When you say callback on a Drupal forum I assume your are talking about "hooks" aka "callbacks", which is this case you are not.

Yes of course you need to write an a-synchronize call, this is the only way this is going to work!

I ask you again, if you do not have anything meaningful to contribute, please don't post.

WorldFallz’s picture

I would think you could format the search.result.tpl.php and search.results.tpl.php files to spit out xml.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

pan69’s picture

Hi. Thanks for your comment. Theming the search results would be an option but would that break the search functionality in the admin system, wouldn't it? What I was actually looking for was an XML-RPC type call. Something that wouldn't interfere with the look and feel of the Drupal system itself. It would perform a seach and return the results as an XML format.

I was hoping for some sort of search API that I can make calls to and that returns me database objects that I can then format anyway I want (like you can with nodes). I understand that I can call do_search to perform a search but what would be the best way to catch the results and prepare them for formatting. I was hoping for something like hook_search_results that would pass in a list of search results. Alas...

Any assistance is much appreciated.

Cheers,
Luke