Esempio n. 1
0
function getSearchResultString($query)
{
    $search_results = get_search_results("{$query}", "", "", "and", "", "");
    extract($search_results);
    global $urlRequestRoot, $cmsFolder;
    $resultHTML = "<link rel='stylesheet' media='print' type='text/css' href=\"{$urlRequestRoot}/{$cmsFolder}/templates/common/search.css\" />";
    if ($search_results['did_you_mean']) {
        $dym = quote_replace(addmarks($search_results['did_you_mean']));
        $resultHTML .= <<<DIDYOUMEAN
\t\t\t<div id="did_you_mean">
\t\t\t\tDid You Mean: <a href="./+search&query={$dym}&search=1">{$search_results['did_you_mean_b']}</a>
\t\t\t</div>
DIDYOUMEAN;
    }
    if ($search_results['ignore_words']) {
        $resultHTML .= '<div id="common_report">';
        $ignored = '';
        while ($thisword = each($ignore_words)) {
            $ignored .= " " . $thisword[1];
        }
        $resultHTML .= '</div>';
    }
    if ($search_results['total_results'] == 0) {
        $resultHTML .= '<div id ="result_report">';
        $resultHTML .= str_replace('%query', $ent_query, "Sorry! No matches found.");
        $resultHTML .= '</div>';
    }
    if ($total_results != 0 && $from <= $to) {
        $resultHTML .= '<div id ="result_report">';
        $res = 'Results';
        $res = str_replace('%from', $from, $res);
        $res = str_replace('%to', $to, $res);
        $res = str_replace('%all', $total_results, $res);
        $matchword = "matches";
        if ($total_results == 1) {
            $matchword = "match";
        } else {
            $matchword = "matches";
        }
        $res = str_replace('%matchword', $matchword, $res);
        $res = str_replace('%secs', $time, $res);
        $resultHTML .= $res;
        $resultHTML .= '</div>';
    }
    if (isset($qry_results)) {
        $resultHTML .= '<div id="results">';
        foreach ($qry_results as $_key => $_row) {
            $last_domain = $domain_name;
            extract($_row);
            if ($sph_show_query_scores == 0) {
                $weight = '';
            } else {
                $weight = "[{$weight}%]";
            }
            if ($domain_name == $last_domain && $sph_merge_site_results == 1 && $domain == "") {
                $resultHTML .= '<div class="idented">';
            }
            $resultHTML .= "<b>{$num}.</b> {$weight} \n";
            $resultHTML .= "<a href=\"{$url}\" class=\"sph_title\">" . ($title ? $title : 'Untitled') . "</a><br/>\n";
            $resultHTML .= "<div class=\"description\">{$fulltxt}</div>\n";
            $resultHTML .= "<div class=\"url\">{$url2} - {$page_size}</div>\n";
            if ($domain_name == $last_domain && $sph_merge_site_results == 1 && $domain == "") {
                $q = quote_replace(addmarks($query));
                $resultHTML .= "[ <a href=\"./+search&query={$q}&search=1&results={$results_per_page}&domain={$domain_name}\">More results from {$domain_name}</a> ]";
                $resultHTML .= "</div class=\"idented\">\n";
            }
            $resultHTML .= "<br />\n";
        }
        $resultHTML .= '</div>';
    }
    if (isset($other_pages)) {
        if ($adv == 1) {
            $adv_qry = "&adv=1";
        }
        if ($type != "") {
            $type_qry = "&type={$type}";
        }
        $resultHTML .= "<div id=\"other_pages\">\nResult page: ";
        if ($start > 1) {
            $q = quote_replace(addmarks($query));
            $resultHTML .= "<a href=\"./+search&query={$q}&start={$prev}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">Previous</a>";
        }
        foreach ($other_pages as $page_num) {
            if ($page_num != $start) {
                $q = quote_replace(addmarks($query));
                $resultHTML .= "<a href=\"./+search&query={$q}&start={$page_num}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">{$page_num}</a>";
            } else {
                $resultHTML .= "<b>{$page_num}</b>";
            }
        }
        if ($next <= $pages) {
            $q = quote_replace(addmarks($query));
            $resultHTML .= "<a href=\"./+search&query={$q}&start={$next}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">Next</a>";
        }
        $resultHTML .= '</div>';
    }
    return $resultHTML;
}
Esempio n. 2
0
                        <?php 
                    } else {
                        ?>
	
                        <b><?php 
                        print $page_num;
                        ?>
</b>
                        <?php 
                    }
                }
                if ($next <= $pages) {
                    ?>
	
                    <a href="<?php 
                    print 'search.php?query=' . quote_replace(addmarks($query)) . '&start=' . $next . '&search=1&category=' . $category . '&catid=' . $catid . '&mark=' . $mark . '&results=' . $results_per_page . $type_qry . $adv_qry . '&domain=' . $domain;
                    ?>
"><?php 
                    print $sph_messages['Next'];
                    ?>
</a>
                    <?php 
                }
                ?>
	
                </div>
                <?php 
            }
        }
        break;
    default: