You can still do that.
You still use the phptemplate_search_page().
Do your own search, and then array_merge() with $results, and then call theme('search_item') on the combined result.
Thanks, but I like to user the other result like the drupal result and I like to mix it.
2009-03-25 16:22 keltezéssel, Khalid Baheyeldin írta:This is what we do on a Drupal 5 site. Should work more or less the same on D6 as well.
In template.php, we include an inc file that handles the XML from the external site, and then we add "sponsored results". Like so:
function phptemplate_search_page($results, $type) {
$enable_external = FALSE;
$external = path_to_theme() . '/something_search.inc';
if (file_exists($external)) {
include_once($external);
if (function_exists('external_search')) {
$enable_external = TRUE;
// This is the search term. Remove + in case it is a multiword search
//$key = trim(preg_replace('/\+/i', ' ', arg(2)));
$key = arg(2);
// run the function to get results
$external_results = external_search($key);
list($jr_top, $jr_bottom, $jr_sidebar) = $external_results;
}
}
$output = '<dl class="search-results">';
if ($enable_external) $output .= '<div class="sponsored">' . $jr_top . '</div>';
foreach ($results as $entry) {
$output .= theme('search_item', $entry, $type);
}
if ($enable_external) $output .= '<div class="sponsored">' . $jr_bottom . '</div>';
$output .= '</dl>';
$output .= theme('pager', NULL, 10, 0);
return $output;
}
2009/3/25 Ámon Tamás <amont@5net.hu>
Hello,
I like to add some search result from a different site to drupal. I like to show the search results mixed in the other and drupal site. I try to use mnogosearch to index the other site, but I can not insert the results to the drupal results. How can I make it?
Ámon Tamás
Sitefejlesztő és programozó
--
5NET Informatikai Kft.
1062 Budapest, Aradi utca 38. A 3/11
telefon: (1) 461-0205 | fax: (1) 461-0206
e-mail: amont@5net.hu | web: http://www.5net.hu
--
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
Simplicity is the ultimate sophistication. -- Leonardo da Vinci
Ámon Tamás Sitefejlesztő és programozó -- 5NET Informatikai Kft. 1062 Budapest, Aradi utca 38. A 3/11 telefon: (1) 461-0205 | fax: (1) 461-0206 e-mail: amont@5net.hu | web: http://www.5net.hu