How to implement Google cse with custom searchbox form #codeigniter

Before making the controller and the view, to get its engine id should you enter this url first  .


View *search form

<div class="input-group">
<input name="q" required="true" type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-theme-bg" type="submit">Go!</button>

Controller *search

$xyz=   $_GET['q'];

$this->meta = array( 'active_menu' => 'search','active_read' => 'search','meta_judul' => $xyz."Search from",'meta_tag' => $xyz,'deskripsi' => "Search result of ".$xyz );

$meta = $this->meta;      

Result View 

<div class="results-sidebar-box">
(function() {
  var cx = 'YOUR_ENGINE_ID';
  var gcse = document.createElement('script');
  gcse.type = 'text/javascript';
  gcse.async = true;
  gcse.src = '' + cx;
  var s = document.getElementsByTagName('script')[0];
  s[removed].insertBefore(gcse, s);
</div><!--result box-->

finished , for a demo please do a search on the menu of this website . I hope this helps

About the Author

Entol Fakih

Gairah terbesar Saya adalah hiking ke hutan dan menikmati keindahan alam. Meskipun berjiwa romantis, saya adalah geek keseluruhan seperti anggota tim lainnya.Hal yang dapat menjauhkan saya dari komputer adalah fotografi.

Entol Fakih