Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * From configuration settings.
- */
- /**
- * At a minimum, change the sitesearch value to the new site's domain
- */
- define('GSA_SEARCH_PARAMS', serialize(array(
- 'site' => 'default_collection',
- 'proxystylesheet' => 'wc_standard',
- 'client' => 'wc_standard',
- 'output' => 'xml_no_dtd',
- 'sitesearch' => 'subdomain-to-search.missouri.edu'
- )));
- /**
- * GSA's site search url
- */
- define('GSA_SEARCH_URL','http://search.missouri.edu/search?');
- ?>
- <?php
- /**
- * Template Name: Search
- *
- * Displays search results from the GSA. Also doubles as the the template to
- * be attached to the Search page created in wordpress.
- *
- * @package WordPress
- * @subpackage SITENAME
- * @category theme
- * @category template
- * @author Paul F. Gilzow, Web Communications, University of Missouri
- * @copyright 2013 Curators of the University of Missouri
- */
- $arySearchParams = unserialize(GSA_SEARCH_PARAMS);
- /**
- * Doesnt matter if s or q has been used as the search parameter, we want to use either to invoke a gsa search
- */
- if ( (isset( $_GET['q'] ) && $_GET['q'] != '') || (isset($_GET['s']) && $_GET['s'] != '')) {
- // Add search inputs to query array
- $arySearchParams['q'] = (isset($_GET['q'])) ? $_GET['q'] : $_GET['s'];
- if(is_array($arySearchParams['q'])) $arySearchParams['q'] = implode (' ', $arySearchParams['q']);
- if ( isset($_GET['start']) && $_GET['start'] != '') $arySearchParams['start'] = $_GET['start'];
- if ( isset($_GET['sort']) && $_GET['sort'] != '') $arySearchParams['sort'] = $_GET['sort'];
- if ( isset($_GET['filter']) && $_GET['filter'] != '') $arySearchParams['filter'] = $_GET['filter'];
- $arySearchParams['q'] = stripcslashes($arySearchParams['q']);
- $strResults = file_get_contents(GSA_SEARCH_URL.http_build_query($arySearchParams));
- }
- $boolNoResults = (!isset($strResults) || $strResults == '') ? true : false;
- get_header();
- ?>
- <div id="default">
- <?php get_template_part('aside','example'); ?>
- <h2 id="skip">Search<?php if(!$boolNoResults) echo ' Results'; ?></h2>
- <?php if($boolNoResults): ?>
- <?php get_search_form(); ?>
- <?php else :?>
- <?php echo $strResults;?>
- <?php endif;?>
- </div><!-- #default -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement