Social Web Directory :: Social Network Directory :: Ning Tips and Ning Support
Warning: I don't think this will return correct results on a Private site, since Google has to crawl your site for the search. It's doubtful.
How to replace your NingBar Search with a custom Google Search.
Prepare a Page for your Google Search results.
<div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results"; var googleSearchFormName = "cse-search-box"; var googleSearchFrameWidth = 600; var googleSearchDomain = "www.google.com"; var googleSearchPath = "/cse";
</script>
<script src="http://www.google.com/afsonline/show_afs_search.js" type="text/javascript"></script>

Create Your Custom Google Search Code, go here:
http://www.google.com/cse/
Edit/Add Special Script to Custom Code Box:
<!-- Replace NingBar Search with Google Search -->
<script type="text/javascript">
xg.addOnRequire(function() {
document.getElementById('xn_bar_menu_search').action = 'http://yoursite.ning.com/page/search-results';
var cx = document.createElement('input');
cx.setAttribute('name', 'cx');
cx.setAttribute('value', '001999399379599247143:kvoos9-d1w4');
cx.setAttribute('type', 'hidden');
document.getElementById('xn_bar_menu_search').appendChild(cx);
var ie = document.createElement('input');
ie.setAttribute('name', 'ie');
ie.setAttribute('type', 'hidden');
ie.setAttribute('value', 'UTF-8');
document.getElementById('xn_bar_menu_search').appendChild(ie);
var cof = document.createElement('input');
cof.setAttribute('name', 'cof');
cof.setAttribute('type', 'hidden');
cof.setAttribute('value', 'FORID:11;NB:1');
document.getElementById('xn_bar_menu_search').appendChild(cof);
var sa = document.createElement('input');
sa.setAttribute('name', 'sa');
sa.setAttribute('type', 'hidden');
sa.setAttribute('value', 'Search');
document.getElementById('xn_bar_menu_search').appendChild(sa);
});
</script>
NOT ENOUGH ROOM IN CUSTOM CODE BOX?
I had this problem, too.
Instructions on how to move "Custom Code Box" code above, to a js file:
Credits:
Thank you to TJ of http://jqueryhelp.ning.com/, and Ning Creators. TJ reviewed and helped test this code. The original js code came from Ning Creators.
Enjoy!
Jen
Tags: bar, custom google search, google search, ning, ning search, ningbar, replace ning search, search
Permalink Reply by Bernard Lama on October 20, 2012 at 3:59am Finally it works for me. Thanks Jen.
Permalink Reply by Joe on December 23, 2012 at 10:52am thanks for the tip
1 question : Adsense rules make it clear that we should not modify codes - doesnt this go against this rule? as we are not putting the code exactly as given by adsense
thanks
Permalink Reply by JenSocial on December 23, 2012 at 11:11am Hi Joe,
Of course I can't make any guarantees when it come to Google. But, I definitely don't think this code affects any adsense rules. You're just replacing Ning's search with a custom Google Search. Ning Creators uses this as well.
Happy Holidays,
Jen



Started by Comunidad Stargardt in Ask For Ning Help (Support Questions). Last reply by Laura Higuera on Friday. 3 Replies 0 Favorites
Started by JenSocial in Ning Tips & Tricks 3.0. Last reply by Writer Chick on Thursday. 29 Replies 0 Favorites
Started by Alisa Gaylon in Ask For Ning Help (Support Questions). Last reply by JenSocial on Thursday. 3 Replies 0 Favorites
© 2013 Created by JenSocial.
Powered by
© Copyright JenSocial.
