Guest User

Untitled

a guest
Jun 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <?php
  2.  
  3. class Page extends SiteTree {
  4.  
  5. public static $db = array(
  6. );
  7.  
  8. public static $has_one = array(
  9. );
  10.  
  11. }
  12.  
  13. class Page_Controller extends ContentController {
  14.  
  15. public function init() {
  16. parent::init();
  17.  
  18. // Note: you should use SS template require tags inside your templates
  19. // instead of putting Requirements calls here. However these are
  20. // included so that our older themes still work
  21. Requirements::themedCSS("layout");
  22. Requirements::themedCSS("typography");
  23. Requirements::themedCSS("form");
  24. }
  25.  
  26. public function getBufferedContent() {
  27. ob_start();
  28. include('wartabud.php');
  29. $return = ob_get_contents();
  30. ob_end_clean();
  31. return $return;
  32. }
  33.  
  34.  
  35.  
  36. /**
  37. * Site search form
  38. */
  39. function SearchForm() {
  40. $searchText = isset($_REQUEST['Search']) ? $_REQUEST['Search'] : 'Search';
  41. $fields = new FieldSet(
  42. new TextField("Search", "", $searchText)
  43. );
  44. $actions = new FieldSet(
  45. new FormAction('results', 'Search')
  46. );
  47.  
  48. return new SearchForm($this, "SearchForm", $fields, $actions);
  49. }
  50.  
  51. /**
  52. * Process and render search results
  53. */
  54. function results($data, $form){
  55. $data = array(
  56. 'Results' => $form->getResults(),
  57. 'Query' => $form->getSearchQuery(),
  58. 'Title' => 'Search Results'
  59. );
  60.  
  61. return $this->customise($data)->renderWith(array('Page_results', 'Page'));
  62. }
  63.  
  64. }
  65.  
  66. ?>
Add Comment
Please, Sign In to add comment