I have a site that keeps a searchable database of teachers and classes. I'm trying to switch it over to using Drupal. I'm a relative newbie and I can't figure out how to do the following....

I'd like the user to type a search string, then show two sets of results. By default, they'd see a list of teachers matching the query under one tab. Clicking the 'classes' tab would repeat the query for classes. Should they click the 'teachers' tab again, they'd see the teacher list one more time.

Now, I know enough to build the block with the search form, and the menus with local tasks for the tabs. I can even get the initial query to show the list of teachers. But what I can't do is the clicking back and forth between tabs. That is, if I click the classes tab then the teacher tab again, I can't preserve the initial query string.

If that description doesn't make sense, try this...

1. Go to drupal.org (you're already there).

2. Search for something (i.e. 'test') in the upper right corner search form.

3. You'll see three tabs there: 'content', 'cvs', and 'CVS commit messages'.

4. Click any of three tabs.

Your query is now forgotten, and you have to type it in again. So, is there any way to not forget the query? Is there some hook to append the query string to the tab URLs? What about using -cringe- javascript?

Thanks in advance.

-Dave

Comments

Steven’s picture

I'm planning on implementing something similar for CVS/4.6 search tabs. If you can wait a few days and don't mind using the CVS development version (which is quite stable, it just that many contributed modules are not yet updated), you can use that.

--
If you have a problem, please search before posting a question.

Dave Cohen’s picture

Steven, thanks for replying. I'm comfortable with cvs, but I wouldn't want to build my site on anything too bleeding edge.

I'm curious how you're planning to address this. I was thinking about, and it seems if I could append the contents of $_REQUEST (urlencoded) as variables at the end of the tab links, that would do the trick. In fact I came close by appending something like "?edit[query]=$query" to my menu item's path, but that only worked for the non-default tab. I'm considering hacking something into menu.inc's theme_menu_item().

Can you briefly tell me what you're planning? Otherwise, just let me know when it's checked in.

Marandb’s picture

Is there any update on this? Adding this functionality is a great idea & is exactly what I am looking for.

Thanks,
Marand B.