View Single Post
  #1  
Old 02-24-2012, 09:46 AM
deverill2010 deverill2010 is offline
 
Join Date: Jan 2011
Posts: 412
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Radio Buttons for search

I currently have a custom google search bar on my site which only searches sites that I have allowed in google when creating the search. The search results are also displayed within a page which looks like my website. This all works fantastically well but I would like to add to improve the search.

I want to add two radio buttons, one for WWW and one for my site, so when the radio button WWW is selected it does as abve searches the sites I have allowed in google and displays them within its page as it currently does.

When my sites radio button is selected it just does a quick search of MY SITE only and displays the results in a page looking like my site.

I have tried before to do this but haven't been able to master it, I would really appreciate any help as I really realy want this.

Here is my crrent search code in the navbar template -

Code:
		<div id="globalsearch" class="globalsearch">
<form action="http://www.midwiferyonline.co.uk/googlesearch.php" id="cse-search-box">
  <div>
    <input type="hidden" name="cx" value="partner-pub-XXXXXXXXXXXXXXXXXXXXXXXX" />
    <input type="hidden" name="cof" value="FORID:10" />
    <input type="hidden" name="ie" value="UTF-8" />
  <span class="textboxcontainer"><span>  <input type="text" name="q" size="20" /></span></span>
<span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search<vb:if condition="$stylevar['textdirection'] == 'rtl'">_rtl</vb:if>.<vb:if condition="(is_browser('ie') AND !is_browser('ie', 7) AND !is_browser('ie', 8))">gif<vb:else />png</vb:if>" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
  </div>
</form>
And my google search.php

PHP 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');



// #######################################################################

// ######################## 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());



?>
Any help please?
Attached Images
File Type: jpg search.jpg (23.9 KB, 0 views)
File Type: jpg current search.jpg (61.0 KB, 0 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01303 seconds
  • Memory Usage 1,820KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete