Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
552 views
in Themes by
closed by

hi

i add a google cse in the header of my q2a site by editing qa-theme.php

and i moved q2a search to the sidebar

google cse working ok  but when i search in the q2a search and click on the search button , google search is working too and 2 search engines (q2a and cse) showing the results !!!!

i think they have same id for searching ???

how can i change the search id of q2a for resolving Interaction of two search engines ???

google cse code :

$this->output('<div class="gsearch">');
$this->output(<<<EOF
<script>   (function() {
    var cx = '011900192141920744246:n9jj1rxodww';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>
EOF
);
$this->output('</div>');

 

and q2a search engine code :

function search_widget()
{
$this->output(
'<aside id="search-4" class="widget widget_search">',
'<p class="widget-title">جستجو در سوالات</p>',
'<form role="search" method="get" id="searchform" class="searchform" action="'.qa_opt('site_url').'?qa=search">',
'<div>',
'<label class="screen-reader-text" for="s">جستجو برای :</label>',
'<input type="hidden" name="qa" value="search">'
);
$this->output(<<<EOF
<input id="s" name="q" value="جستجوگر داخلی سایت ..." onfocus="if (this.value == 'جستجوگر داخلی سایت ...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'جستجوگر داخلی سایت ...';}" type="text">
EOF
);
$this->output(
'<input type="submit" id="searchsubmit" value="جستجو" />',
'</div>',
'</form>',
'</aside>'
);
}

 

thank you helping me ;)

 

Q2A version: 1.7
closed with the note: problem solved

1 Answer

0 votes
by
 
Best answer
Problem Solved By replace 'q' with 'i' in q2a search engine core
...