1
BeautyBrains
custom html or php search page for google search results

I am using the google custom search box and would like to have the results show within a page I've created; googlesearch.php. Could you take a look at the script I have written and tell me why I am getting this...
Parse error: syntax error, unexpected '<' in /home/content/x/x/x/myusername/html/googlesearch.php on line 4
My line 4 is the google search code which I'm not supposed to touch...

include( XOOPS_ROOT_PATH. "http://caribbeanancestry.com/home/content/x/x/x/myusername/html/forums/mainfile.php" ) ;
include XOOPS_ROOT_PATH. "http://caribbeanancestry.com/home/content/x/x/x/myusername/html/forums/header.php" ;



}
include XOOPS_ROOT_PATH."http://caribbeanancestry.com/home/content/x/x/x/myusername/html/forums/footer.php";
?>

2
ghia
Re: custom html or php search page for google search results
  • 2009/10/11 1:22

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Why do you combine the XOOPS_ROOT_PATH with an http link?
That path is defined in mainfile.php, so you can't use it for including mainfile.php.

3
BeautyBrains
Re: custom html or php search page for google search results

I added it because this is what I found searching online for answers. The only difference in the responses that I found is that some used require instead of include and some used " instead '. All responses gave me errors.

Before posting here I had already tried it with and without the http, the roots path command, and the above statements.

My intention is to use it with the iframe mod so it will open within my site. Could you please paste exactly what I am to put. Thanks

4
deka87
Re: custom html or php search page for google search results
  • 2009/10/11 9:07

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


my google search page looks like this if this can help you


include("../../mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");

?>

  

    
    
    
    
    
  







  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 800;
  var googleSearchDomain = "www.google.com";
  var googleSearchPath = "/cse";



include(XOOPS_ROOT_PATH."/footer.php");
?>

5
BeautyBrains
Re: custom html or php search page for google search results

Thanks for all the help. None of the above worked but its for the better and I'll tell you why. If I were to implement it and my site showed up in the search results, which it will, it would open within the frame of my site, thus, I would have two left side menus etc. So for me, its best to have the result open in its own window.

6
ghia
Re: custom html or php search page for google search results
  • 2009/11/9 23:15

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


The script from deka87 is to be placed two levels deep eg on /modules/mymodule/ or /themes/mytheme/

I think the tags in it should be removed.

7
DarinAllan
Re: custom html or php search page for google search results

This is what I have done

I signed up to this

Google Custom Search

After configuring the Google Custom Search it gives you some code to use, first thing I did was placed this code in a custom block. You will see the block and how it looks with a search field


<
form action="http://www.ozms.org/gsearch.php" id="cse-search-box">
  <
div>
    <
input type="hidden" name="cx" value="partner-pub-xxxxxxx:xxx-xxx" />
    <
input type="hidden" name="cof" value="FORID:11" />
    <
input type="hidden" name="ie" value="ISO-8859-1" />
    <
input type="text" name="q" size="15" />
    <
input type="submit" name="sa" value="Search" />
  div>
form>
<
script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box?=en">script>


Then I get this code and place it in this file saved in the root of my site

gsearch.php

if (file_exists("mainfile.php")) {
    include(
"mainfile.php");
}
elseif(
file_exists("../mainfile.php")) {
    include(
"../mainfile.php");
}
else {
    include(
"../../mainfile.php");
}
include(
XOOPS_ROOT_PATH "/header.php");
$xoopsTpl->assign('xoops_showrblock'0); // 1 display right blocks
$xoopsTpl->assign('xoops_showlblock'1); // 1 display right blocks
?>


  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 800;
  var googleSearchDomain = "www.google.com.au";
  var googleSearchPath = "/cse";


include(XOOPS_ROOT_PATH "/footer.php");
?>


It's a bit of stuffing about but it works well.

You can see it here!

:o)

Login

Who's Online

366 user(s) are online (277 user(s) are browsing Support Forums)


Members: 0


Guests: 366


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits