Hi,
I built a simple block module with a select box (where a user can select a certain type of user or project or og group) and can fill in a search term.
At submit it queries the nodes that have theses tags.
The results, links to user profiles or nodes, have to be printed on the page.
I dont know how to print the results.
I want to go to another page, and show the results there... But how can I do that?
<?php
// $Id$
/*
* @file
* Searches on Project, Person, Freelancer or Group. Search will be done on taxonomy.
*/
define('GENERAL_TAGS_VID', 25);
/**
* Implementation of hook_menu().
*/
function vm_search_menu() {
$items['zoek'] = array(
'title' => t('Zoek'),
'page callback' => 'zoek_view',
'access arguments' => array('search content'),
'type' => MENU_SUGGESTED_ITEM,
);
return $items;
}
/**
* Define the form.
*/
function vm_search_general_search_form() {
$search_on = array(
'project' => 'Zoek project',
'freelancer' => 'Zoek freelancer',
'persoon' => 'Zoek persoon',
'groep' => 'Zoek groep',
);
$form['search_on'] = array(
'#type' => 'select',
'#options' => $search_on,
);
$form['search_term'] =
array('#type' => 'textfield',
'#autocomplete_path' => 'taxonomy/autocomplete/'. GENERAL_TAGS_VID,
'#maxlength' => 1024,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Zoek'),
);
return $form;
}
function vm_search_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('General Search');
return $blocks;
case 'view':
$block['subject'] = t('Zoek');
$block['content'] = drupal_get_form('vm_search_general_search_form');
return $block;
}
}
function vm_search_general_search_form_submit($form, &$form_state) {
switch ($form_state['values']['search_on']) {
case 'project':
case 'groep':
$nodes = search_nodes($form_state);
break;
case 'freelancer':
case 'persoon':
$users = search_users($form_state);
}
dpm($form_state);
}