The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
|||
|
|||
Hmm...I threw together a test page based on your script and it seems to work. I'll post it in case it helps you somehow:
PHP Code:
|
#12
|
|||
|
|||
I get
Parse error: syntax error, unexpected $end in /home/midwife/public_html/googlesearch.php on line 1 That when using that? |
#13
|
|||
|
|||
Are you sure you got it all? Maybe you missed the } on the last line or something.
|
#14
|
|||
|
|||
Sorry I'll try it again, im not that hot with this stuff. I appreciate your help honestly I do. This is something I have wanted for ages!
So the above code is meant to go where? replace my googlesearch.php? if so then what goes here - Code:
echo '<form action="test.php"> |
#15
|
|||
|
|||
OK, I'm sorry, I wasn't very clear. That's just a test file, it shouldn't replace anything you have. Put it in a file called test.php, copy it to your forum directory, then go to it in your browser. When you press 'submit query' it should go to the forum search page or just print out "search google", depending on which radio button is selected. It's just supposed to show that the radio buttons and the redirect work.
|
#16
|
|||
|
|||
And so it does lol.
Sorry for being a total dim ass. Why wont it work actually on the site then? I did have a play with this before several times and I just couldnt figure it out |
#17
|
|||
|
|||
So you put this in your googlesearch.php just under the global.php require line?:
Code:
if ($_REQUEST['source'] == 0) { $vbulletin->url = 'search.php?do=process&query=' . urlencode($_REQUEST['q']); print_standard_redirect('', false); } If that's true, then temporarily change it to this: Code:
if (1 || $_REQUEST['source'] == 0) { $vbulletin->url = 'search.php?do=process&query=' . urlencode($_REQUEST['q']); print_standard_redirect('', false); } that should make it always go to your site search page. |
#18
|
|||
|
|||
Just gives me a blank page again on both radio buttons with this as the url -
Code:
http://www.midwiferyonline.co.uk/googlesearch.php?cx=partner-pub-XXXXXXXXXXXXXXXXXXXX&cof=FORID%3A10&ie=UTF-8&q=help&source=0&submit.x=12&submit.y=17&siteurl=www.midwiferyonline.co.uk%2Fforum.php&ref=www.midwiferyonline.co.uk%2Fsearch.php%3Fsearchid%3D115193 Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('THIS_SCRIPT', 'Googlesearch'); define('CSRF_PROTECTION', true); // change this depending on your filename // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array(); // get special data templates from the datastore $specialtemplates = array(); // pre-cache templates used by all actions $globaltemplates = array('googlesearch', ); // pre-cache templates used by specific actions $actiontemplates = array(); // ######################### REQUIRE BACK-END ############################ // if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line // chdir ('/path/to/your/forums'); require_once('./global.php'); if (1 || $_REQUEST['source'] == 0) { $vbulletin->url = 'search.php?do=process&query=' . urlencode($_REQUEST['q']); print_standard_redirect('', false); } // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = construct_navbits(array('' => 'Google Search')); $navbar = render_navbar_template($navbits); // ###### YOUR CUSTOM CODE GOES HERE ##### $pagetitle = 'Google Search'; // ###### NOW YOUR TEMPLATE IS BEING RENDERED ###### $templater = vB_Template::create('googlesearch'); $templater->register_page_templates(); $templater->register('navbar', $navbar); $templater->register('pagetitle', $pagetitle); print_output($templater->render()); ?> |
#19
|
|||
|
|||
Well, I'm puzzled - it looks OK to me. Try commenting out the print_standard_redirect line (put // in front of it)
|
#20
|
|||
|
|||
Ah!
Now my search is still giving me the blank page with the funny URL, even though I have removed the edits? My googlesearch.php is back to how it was and I have removed the bit from the template too..? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|