MyBB Community Forums
[How To?] Install Google Search - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: [How To?] Install Google Search (/thread-206291.html)



Install Google Search - Roger R - 2016-11-30

Users are complaining about the basic search engine. I have created a custom search from CSE Google -


<script>
  (function() {
    var cx = '007038648298853744575:1rur5psgcxm';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>

can anyone advise on where to insert it?

Thanks in advance.


RE: Install Google Search - WallBB - 2016-11-30

It's simple, you can add the script function in footer and add the
<gscr:search></gsce:search>
where ever you want it to appear(header is a good place).


RE: Install Google Search - Roger R - 2016-11-30

Does the script need to be in its own div?


RE: Install Google Search - Lunorian - 2016-11-30

(2016-11-30, 03:53 PM)Roger R Wrote: Does the script need to be in its own div?

It depends on how you like the style. The div will allow you to add your own CSS to just that selector, or at least make it easier.