function generate_search_results($html_content, $keywords, $number_of_results) { $searchResultsDocument = createDocument(); $resultsTag = generateResultsTag($keywords, $searchResultsDocument); $opensearchQueryTag = generateOpenSearchQueryTag($keywords, $searchResultsDocument); $openSearchTotResultTag = generateOpenSearchTotResultsTag($number_of_results, $searchResultsDocument); $moviematchestag = generate_movies_tags($html_content, $searchResultsDocument); $resultsTag->appendChild($opensearchQueryTag); $resultsTag->appendChild($openSearchTotResultTag); $resultsTag->appendChild($moviematchestag); $searchResultsDocument->appendChild($resultsTag); return $searchResultsDocument->saveXML(); }
function generate_search_results($keywords, $results, $limit = 0) { $searchResultsDocument = createDocument(); $resultsTag = generateResultsTag($keywords, $searchResultsDocument); $opensearchQueryTag = generateOpenSearchQueryTag($keywords, $searchResultsDocument); if ($limit > 0) { $rescount = $limit; } else { $rescount = count($results); } $openSearchTotResultTag = generateOpenSearchTotResultsTag($rescount, $searchResultsDocument); $moviematchestag = generate_movies_tags($results, $searchResultsDocument, $limit); $resultsTag->appendChild($opensearchQueryTag); $resultsTag->appendChild($openSearchTotResultTag); $resultsTag->appendChild($moviematchestag); $searchResultsDocument->appendChild($resultsTag); return $searchResultsDocument->saveXML(); }