search.phtml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © 2016 Ihor Vansach (ihor@magefan.com). All rights reserved.
  4. * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
  5. *
  6. * Glory to Ukraine! Glory to the heroes!
  7. */
  8. ?>
  9. <?php
  10. /**
  11. * Blog sidebar search form template
  12. *
  13. * @var $block \Magefan\Blog\Block\Sidebar\Search
  14. */
  15. ?>
  16. <div class="widget block blog-search" data-bind="scope: 'blog-search'">
  17. <div class="block-content">
  18. <form class="form" id="blog_search_mini_form" action="<?php echo $block->getFormUrl() ?>" method="get">
  19. <div class="field search">
  20. <label class="label" for="blog_search">
  21. <span><?php echo __('Search') ?></span>
  22. </label>
  23. <div class="control">
  24. <input id="blog_search" type="text" name="q" value="<?php echo $block->escapeHtml($block->getQuery()) ?>" placeholder="<?php echo __('Search posts here...') ?>" class="input-text" maxlength="128" role="combobox" aria-haspopup="false" aria-autocomplete="both" autocomplete="off">
  25. </div>
  26. </div>
  27. <div class="actions">
  28. <button type="submit" onclick="return goBlogSearch(this);" title="<?php echo __('Search') ?>" class="action search">
  29. <span><?php echo __('Search') ?></span>
  30. </button>
  31. </div>
  32. </form>
  33. </div>
  34. </div>
  35. <script type="text/javascript">
  36. function goBlogSearch(e)
  37. {
  38. var value = document.getElementById('blog_search').value;
  39. if (value) {
  40. window.location = e.form.action + value + '/';
  41. }
  42. return false;
  43. }
  44. </script>