function OnPageLoad() { echo new XhtmlElement('h1', $this->GetPageTitle()); # If no search term, show a search form (intended for mobile) if (!$this->query instanceof SearchQuery) { ?> <form action="/search" method="get"><div> <input type="search" name="q" /> <input type="submit" value="Search" /> </div></form> <?php return; } if ($this->paging->GetTotalResults()) { # write the paging navbar $paging_bar = $this->paging->GetNavigationBar(); echo $paging_bar; # Load files used for custom formats require_once 'email/email-address-protector.class.php'; require_once 'search/search-highlighter.class.php'; $protector = new EmailAddressProtector($this->GetSettings()); $highlighter = new SearchHighlighter(); echo '<dl class="search">'; foreach ($this->results as $result) { /* @var $result SearchItem */ echo '<dt>'; $title = htmlentities($result->Title(), ENT_QUOTES, "UTF-8", false); $title = $highlighter->Highlight($this->query->GetSanitisedTerms(), $title); echo '<a href="' . htmlentities($result->Url(), ENT_QUOTES, "UTF-8", false) . '">' . $title . "</a> "; echo "</dt>"; echo '<dd>'; $description = htmlentities($result->Description(), ENT_QUOTES, "UTF-8", false); $description = $protector->ApplyEmailProtection($description, AuthenticationManager::GetUser()->IsSignedIn()); $description = $highlighter->Highlight($this->query->GetSanitisedTerms(), $description); echo "<p>" . $description . "</p>"; echo $result->RelatedLinksHtml(); echo '<p class="url">' . htmlentities($this->DisplayUrl($result->Url()), ENT_QUOTES, "UTF-8", false) . "</p>"; if (isset($_GET['debug'])) { echo '<ul class="weight">' . '<li>Matched field weight: <strong>' . $result->WeightOfMatchedField() . '</strong></li>' . '<li>Weight of result type: <strong>' . $result->WeightOfType() . '</strong></li>' . '<li>Weight within type: <strong>' . $result->WeightWithinType() . '</strong></li>' . '<li>Weight: <strong>' . $result->Weight() . '</strong></li>' . '</ul>'; } echo "</dd>"; } echo '</dl>'; echo $paging_bar; } else { ?> <p>Sorry, we didn't find anything matching your search.</p> <p>Please check your spelling, or try rewording your search.</p> <p>If you still can't find what you're looking for, please <a href="/contact/"> contact us</a>.</p> <?php } $this->AddSeparator(); $this->BuySomething(); }
// number of results per page for text link pages (tons to sift through) if (in_array($genre, $genres_rss)) { $resultsperpage = $resultsperpage_rss; } if (in_array($genre, $genres_nonrss)) { $resultsperpage = $resultsperpage_nonrss; } if (in_array($genre, $genres) && $genre != "All" && $artist == "" && $q == "") { // If genre acceptable and isn't all, pagenums set up here include $Include_Dir . "PagedResults.php"; $sql_rss_genre_browse = mysql_query("SELECT name FROM adlinks WHERE active=TRUE and category = '{$genre}' order by name") or die(mysql_error()); $sql_rss_artist_count = mysql_query("SELECT count(id) as num FROM adlinks WHERE active=TRUE and category = '{$genre}'") or die(mysql_error()); $numartistsarray = mysql_fetch_array($sql_rss_artist_count); $numartists = $numartistsarray['num']; /* Start collecting pagination info so we can use it in the title - so we instantiate the paging class */ $Paging = new PagedResults(); $Paging->TotalResults = $numartists; // tell the pager how many results we have $Paging->ResultsPerPage = $resultsperpage; // choose how many results per page, values here override the PagedResults() defaults $Paging->LinksPerPage = 20; // same $Paging->PageVarName = "pagenumber"; // same if (isset($pagenumber)) { // if we have a pagenumber set (from the URL) set that to be the current page in the pager array $Paging->CurrentPage = $pagenumber; } $InfoArray = $Paging->InfoArray(); // creates the infoarray //print("<pre>"); print_r($InfoArray); print("</pre>"); // uncomment to echo the infoarray to see what the pager knows about the page