I probably can use the same approach with DuckDuckGo (https://duckduckgo.com/?q=site%3Awww...%2F+minimalist seems to work fine).
In my defence, I did name the file Javascript - Google Site Search Form.web.
Acorn
Printable View
I probably can use the same approach with DuckDuckGo (https://duckduckgo.com/?q=site%3Awww...%2F+minimalist seems to work fine).
In my defence, I did name the file Javascript - Google Site Search Form.web.
Acorn
You can always become your own search engine.
Most Xara-generated sites are fairly static and as you are the author, you could create a list of keyword and phrases, each with a link to the site page.
I would typically put the list into a Placeholder as an HTML table and use http://www.datatables.net/ to filter to a smaller list as a word was typed into the search box.
A lot more maintenance but tot6al satisfaction that it is wholly internal and not reliant on Big Brother's oversight.
Acorn
Thanks Egg. I was curious and just had a look at the Serif Webplus x8 site. They compare their s/w in a big table with WD10 and Dreamweaver CC2014. I deduce that these three programs are in the same league, but WD10 is the one that does not have search built in (and a bunch of other stuff). I guess Serif and Dreamweaver do searches with php or perl. When I signed up for WD10 premium I was expecting things like search to just be there. Wrong again :rolleyes: I struggle to write code, hence I got a drag'n'drop web editor. I hope that Xara can get a bit more competitive with the likes of Serif and Dreamweaver.
I am so sorry, Acorn, I didn't mean to insinuate anything; you have the interest of the community at heart, this is obvious and I appreciate the great advice and input you've contributed. You are motivated by good intent, and that's what matters, in my book :)
Like Jaydear I have little skill with coding, and I gave up on dreamweaver since version 4. It does appear that serif are using javascript, one of the scripts they anchor to are located in a folder called 'wpscripts' and include scripts labelled "jquery.js' and 'jsSiteSearch.js'. I am currently building a site so I had a look at the code generated for the search function. I haven't published it yet so it's not available online.
Maybe some of the code may help make sense:
On each page where the search box appears (in the head section):
<script type="text/javascript" src="wpscripts/jquery.js"></script>
<script type="text/javascript" src="wpscripts/jquery.wputils.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#site_search_2_input').keypress(function(event) { if ( event.keyCode == 13 ) window.location.href = 'searchresults.html?site_search_results_1='+docume nt.getElementById('site_search_2_input').value+'&d epth=0&swr=false'; });
$('#site_search_2_button').click(function(event) { window.location.href = 'searchresults.html?site_search_results_1='+docume nt.getElementById('site_search_2_input').value+'&d epth=0&swr=false'; });
$("a.ActiveButton").bind({ mousedown:function(){if ( $(this).attr('disabled') === undefined ) $(this).addClass('Activated');}, mouseleave:function(){ if ( $(this).attr('disabled') === undefined ) $(this).removeClass('Activated');}, mouseup:function(){ if ( $(this).attr('disabled') === undefined ) $(this).removeClass('Activated');}});
});
</script>
On the page where the search results appear, in the head:
<script type="text/javascript" src="wpscripts/jsSiteSearch.js"></script> !!place this in the head!!
!!SCRIPT!!
function GetSiteSearchResults(newWindow,frameObject,frameOb jectName,fontFace,fontSize,fontColour,linkFace,lin kSize,linkColour,bgColour,resultsText)
{
var sTerms="";
var iDepth = 0;
var sURL = new String(window.location.href);
if (sURL.indexOf("swr=true") != -1)
return;
if (sURL.indexOf("?") > 0)
{
var arrParams = sURL.split("?" );
var arrURLParams = arrParams[1].split("&" );
for (var i=0;i<arrURLParams.length;i++)
{
var sParam = arrURLParams[i].split("=" );
var sValue = decodeURIComponent(sParam[1]);
if( decodeURIComponent(sParam[0]) == frameObjectName)
sTerms = sValue;
if( decodeURIComponent(sParam[0]) == "depth")
iDepth = parseInt(sValue);
}
}
var d=frameObject.document;
if (sTerms=="") {d.open(); d.write("<html><head></head><body style=\"background: transparent;\"></body></html>" ); d.close();return;}
var sBack=""; for (i=0; i<iDepth; i++) sBack+='..\\\\';
d.open();
d.write("<!doctype html>" );
d.write("<html lang=\"en\">" );
d.write("<head>" );
d.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" );
d.write("</head>" );
d.write("<body style=\"margin: 0px 0px 0px 0px; font-family: "+fontFace+"; font-size: "+fontSize+"; color: "+fontColour+"; background: "+bgColour+";\">" );
d.write("<div id=\"wpSearchResults\"></div>" );
d.write("<script type=\"text/javascript\">" );
d.write("var wordMap = new Array(\" habitasse platea dictumst mauris rutrum enim vitae mauris proin mattis eleifend pede pretium ante amet elit quisque tellus dictum eget dapibus sodales lectus pellentesque molestie adipiscing iaculis quis arcu nulla viverra ultricies velit maecenas magna nisl ipsum rhoncus duis nisi sapien nullam tincidunt fringilla integer curabitur felis erat tempus placerat pellentesque purus diam nunc class aptent taciti sociosqu litora torquent conubia\",\" about \",\" case examples illustrate possibilities opportunities tailored online training learning \",\" access tailored online training from here habitasse platea dictumst mauris rutrum enim vitae mauris proin mattis eleifend pede pretium ante amet elit quisque tellus dictum eget dapibus sodales lectus pellentesque molestie adipiscing iaculis quis arcu nulla viverra ultricies velit maecenas magna nisl ipsum rhoncus duis nisi sapien nullam tincidunt fringilla integer curabitur felis erat tempus placerat pellentesque purus diam nunc class aptent taciti sociosqu litora torquent conubia nostra inceptos hymenaeos aenean risus porttitor vestibulum nibh faucibus justo etiam vulputate egestas neque luctus dolor hendrerit tortor metus turpis tristique lacinia suspendisse potenti feugiat lorem consectetuer cras gravida massa accumsan \",\" resources \",\" recommended links \",\" contact page \",\" terms conditions \",\" search results \",\" \" );" );
d.write("var pageMap = new Array(\"sitename\",\"About\",\"Cases\",\"Train\",\ "Resources\",\"Links\",\"Contact\",\"terms-and-conditions\",\"search_results\",\"Services_details \" );" );
d.write("var linkMap = new Array(\"index.html\",\"about.html\",\"page3.html\" ,\"train.html\",\"resources.html\",\"links.html\", \"contact.html\",\"page8.html\",\"searchresults.ht ml\",\"page10.html\" );" );
d.write("var preMap = new Array(\"placerat pellentesque purus diam nunc class aptent taciti sociosqu litora torquent conubia\",\"About \",\"Case examples to illustrate possibilities and opportunities for tailored online training and learning \",\"In hac habitasse platea dictumst Mauris rutrum enim vitae mauris Proin mattis eleifend pede Sed pretium ante sit amet elit Quisque pede tellus dictum eg\",\"Resources \",\"Recommended links \",\"Contact page \",\"Terms and conditions \",\"Search results \",\"\" );" );
d.write("function doNav(ind)" );
d.write("{" );
if (newWindow)
d.write(" window.open(\""+sBack+"\"+linkMap[ind],\"_blank\" );" );
else
d.write(" parent.window.location.href=linkMap[ind];" );
d.write("}" );
d.write("function wpDoSearch(searchTerms){" );
d.write("var terms = searchTerms.split(\" \" );" );
d.write("if (terms==\"\") return;" );
d.write("var results = \"\";" );
d.write("var resultscount = 0;" );
d.write("for (var i=0; i<wordMap.length; i++)" );
d.write("{" );
d.write(" var found=true;" );
d.write(" for (var j=0; j<terms.length; j++)" );
d.write(" if (wordMap[i].indexOf(terms[j].toLowerCase())==-1) found=false;" );
d.write(" if (found)" );
d.write(" {" );
d.write(" results+=\"<a style=\\\"cursor: pointer; font-family: "+linkFace+"; font-size: "+linkSize+"; color: "+linkColour+"; \\\" onclick=\\\"doNav(\"+i+\" );\\\"><u>\"+pageMap[i]+\"</u></a><br>\"+preMap[i]+\"...<br><br>\";" );
d.write(" resultscount++;" );
d.write(" }" );
d.write("}" );
d.write("document.getElementById(\"wpSearchResults \").innerHTML=resultscount+\" "+resultsText+" \"+searchTerms+\"<br><br>\"+results;" );
d.write("}" );
while(sTerms.indexOf("\"") != -1 ) {
sTerms = sTerms.replace("\"","" );
};
d.write("wpDoSearch(\""+sTerms+"\" );" );
d.write("</script>" );
d.write("</body></html>" );
d.close();
}
On results page, in the body:
</div>
<iframe id="site_search_results_1" name="site_search_results_1" data-results="font-family: 'Verdana'; font-size: 13px; color: #000000;" data-links="font-family: 'Verdana'; font-size: 13px; color: #000000;" style="position:absolute;left:66px;top:166px;width :688px;height:490px;border:none 0px;"></iframe>
</div>
Not sure if this will create more confusion than help, but i thought I'd share this info so that someone in the know may be motivated to make sense of it and perhaps develop a similar function for WD.
Thanks again.
Acorn.....
DUDE!
You are my sunshine.....my only sunshine!!!
Thank you for the search widget....its working "fabulous" on my website :)
(I could not get Google/cse function to work...their site kept freezing up)
I just copied / pasted your widget...I took off that little bit of text at the top where it said search [[....]]
Happy....happy....joy-joy!
:)
Karen
PS: I did submit a updated sitemap.xml to BING and Google, and I have accounts both in BING and Google Webmaster Tools ....I use StatCounter as my direct monitor though, since their code doesn't slow down my website like Google Analytics' code does.
Acorn, coming back to this, is there a way we can keep the results from opening up a page and display it in an iframe or same page without the other ads etc... Just the results?
behzed, here is a revamp file of my original: Attachment 123118
It uses DuckDuckGo instead of Google so no Ads.
If you change target="_blank" to "_top", the results appear in the same page/tab.
I have tried to use an IFRAME on the page to keep things on the same web page but the search sites block IFRAMEs for the results.
I have left an IFRAME there for you to test by changeing the target to the IFRAME's name.
Finally, I now prefer the DuckDuckGo search design page where I want the resuls to appear in the same page/tab.
This is the bottom-most search box.
Acorn
Thank you so much Acorn.