text($input->get->q); 
	// did $q have anything in it?
	if($q) { 
		// Sanitize for placement within a selector string. This is important for any 
		// values that you plan to bundle in a selector string like we are doing here.
		$q = $sanitizer->selectorValue($q); 
		// Search the title and body fields for our query text.
		// Limit the results to 50 pages. 
		$selector = "title|body~=$q, limit=50"; 
		// If user has access to admin pages, lets exclude them from the search results.
		// Note that 2 is the ID of the admin page, so this excludes all results that have
		// that page as one of the parents/ancestors. This isn't necessary if the user 
		// doesn't have access to view admin pages. So it's not technically necessary to
		// have this here, but we thought it might be a good way to introduce has_parent.
		if($user->isLoggedin()) $selector .= ", has_parent!=2"; 
		// Find pages that match the selector
		$matches = $pages->find($selector); 
		// did we find any matches? ...
		if($matches->count) {
			// we found matches
			echo "Found $matches->count page(s) matching your query:
";
			
			// output navigation for them (see TIP below)
			echo "";
			foreach($matches as $match) {
				echo "- $match->title";
				echo "
$match->summary
 ";
			}
			echo "
";
			
			// TIP: you could replace everything from the  above
			// all the way to here, with just this: renderNav($matches); 
		} else {
			// we didn't find any
			echo "Sorry, no results were found.
";
		}
	} else {
		// no search terms provided
		echo "Please enter a search term in the search box (upper right corner)
";
	}
	?>