Skip to content

Instantly share code, notes, and snippets.

@wouterj
Created October 23, 2014 13:27
Show Gist options
  • Select an option

  • Save wouterj/665b897942fb95beda19 to your computer and use it in GitHub Desktop.

Select an option

Save wouterj/665b897942fb95beda19 to your computer and use it in GitHub Desktop.
<!doctype html>
<!-- ... -->
<form action="/search" method="GET">
<input type="text" name="query" placeholder="Search" />
<input type="submit" name="Search" />
</form>
<?php
// ...
class SiteController extends Controller
{
public function searchAction(Request $request)
{
$query = $request->query->get('query');
// perform search query with $query
$results = ...;
return $this->render('search_results.html.twig', array(
'results' => $results,
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment