General
Upcoming Events
- CCB: Band Festival
29 June 2013 10:00-19:00
Band festival with Cologne Concert Brass at the Bürgerhaus Kalk.
Location: Kalk-Mülheimer Straße 58, 51103, Cologne Kalk
Music
Media
IT
Additional
Drost-Tenfelde.dePersonal website of Jannes Drost-Tenfelde, resident bass trombone player at Cologne Concert Brass and Brass Band Merum
General
Upcoming Events
Music
Media
IT
Additional
Version: 2011-05-25 “Rincewind”
Using DokuWiki's standard tpl_searchform to add a search form to your website is quite useful. However, the results this form returns might not be what you want, since they display raw DokuWiki code, rather than rendered html.
The code that outputs the search results is located in inc/html.php on line line 373.
if($num < FT_SNIPPET_NUMBER){ // create snippets for the first number of matches only print '<div class="search_snippet">'.ft_snippet($id,$regex).'</div>'; }
As you can see, the function outputs the result using the ft_snippet function, which is located in inc/fulltext.php on line 297.
If you wish to completely remove the snippts in the search results page, just comment out the print statement on line 373.
Change the original code to:
if($num < FT_SNIPPET_NUMBER){ // create snippets for the first number of matches only // Get the snippet $ft_snippet = ft_snippet( $id, $regex ); // Get the instructions $instructions = p_get_instructions( $ft_snippet ); // Render html $snippet = html_entity_decode( p_render('xhtml', $instructions, $info ) ); // Remove all hyperlinks, since they are potentially broken) $snippet = preg_replace('#<a.*>(.*)</a>#isU', '$1', $snippet); // Output the HTML print '<div class="search_snippet">'.$snippet.'</div>'; }
This code still uses the ft_snippet function, but takes the snippets and turns them into properly rendered HTML. Unfortunately, the ft_snippet function breaks the pages up in pieces, which might mean that certain links stop function. For this reason, all hyperlinks are removed from the rendered snippets.
Change the original code to:
if($num < FT_SNIPPET_NUMBER){ // create snippets for the first number of matches only // Get the instructions of the page $instructions = p_get_instructions( rawWiki( $id ) ); // Render html $snippet = p_render('xhtml', $instructions, $info ); // Output the HTML print '<div class="search_snippet">'.$snippet.'</div>'; }
This option allows you to display the complete page for every page. I personally think it is unwise to do this, but you could potentially use styles on div.search_result and span.search_cnt to only display the contents if the user hovers over the link.