Jump to content

Problem with search form


Mijo
 Share

Recommended Posts

Hello, I'm having a problem with search form on my website, it throw me an error "Error: Exception: Field does not exist: body (in C:\xampp\htdocs\testweb\wire\core\PageFinder.php line 993)"

My search.php (template) is: 



<?php
	$q = $sanitizer->text($input->get->q); 

	if($q) { 

		$q = $sanitizer->selectorValue($q); 

		$selector = "title|body~=$q, limit=50"; 

		if($user->isLoggedin()) $selector .= ", has_parent!=2"; 

		$matches = $pages->find($selector); 

		if($matches->count) {

			echo "<h2>Found $matches->count page(s) matching your query:</h2>";

			echo "<ul class='nav'>";

			foreach($matches as $match) {
				echo "<li><a href='$match->url'>$match->title</a>";
				echo "<div class='summary'>$match->summary</div></li>";
			}

			echo "</ul>";


		} else {

			echo "<h2>Sorry, no results were found.</h2>";
		}

	} else {

		echo "<h2>Please enter a search term in the search box (upper right corner)</h2>";
	}
?>

My form is:

  <form class='search' action='<?php echo $pages->get('template=search')->url; ?>' method='get'>
		<label for='search' class='visually-hidden'>Search:</label>
		<input type='text' name='q' id='search' placeholder='Search' value='' />
		<button type='submit' name='submit' class='visually-hidden'>Search</button>
	</form>

This is example from Minimal Site Profile, but I can not make it work, can you please give me some advice,. :-) thank you very much.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...