tags:

views:

136

answers:

2

Hello,

I have for example a module in my applications called 'Books'. Also I have several others modules in which I want to use a 'search a book' functionality (reuse the search form).

How can I achieve that?

I tried to make a component for this and use it in other modules templates, but I don't know how to return the found book id from it (I use some ajax, but no luck). Or maybe this is just a wrong approach.

Any suggestions? Thanks.

A: 

You wouldnt use a component really unless you want to render a partial as part of the process. With that said you could simply return the string of the id in that partial view or return a complete json representation or whatever else you need.

prodigitalson
Ok, let's say I implement a book form (with method in actions.class.php) inside the book module. How can I display this in another view from another module and use it?Basically, I want only another module view page this search form, which after search return the id but not refresh the page (and from that point that module will use this id)
Cristian N
Or, you can use a seprate module for ajax interactions and make requests from component's template on any view of any module.
Darmen
A: 

Have you looked into the sfLucene plugin?

The plugin allows you to index the models you require and give weighting if you require.

From the search results you can set the route to be show, so your results can point to exactly the page you require.

It is fairly easy to create a partial containing a search form to be added to your layout too, so you can have the search box on any age you wish.

Jon Winstanley