Welcome! Log In Create A New Profile

Advanced

Json Theme. You can get sphider results with json.

Posted by damiles 
Json Theme. You can get sphider results with json.
June 08, 2009 11:54AM
I create a new Theme for sphider for json support.

You now can use a json call for get results of your queries, from one domain to another domain of your search engine, and show the results as you want in your page.

There is the link of json theme: http://blog.damiles.com/json.zip

ToDo: categories.html

I expect this can be usefull.
Please send your feedback.
Re: Json Theme. You can get sphider results with json.
August 17, 2009 09:59PM
damiles,

this is a really great addition. It would indeed be very useful and a make it possible to display results in a very flexible way.

I've got to questions:

1) I get an error (invalid json) when I try to validate the json output in: http://json.parser.online.fr/
2) can you give us an example of jquery syntax that you use to display the results?

Thanks again,

Robert
Re: Json Theme. You can get sphider results with json.
August 27, 2009 07:19AM
Hi, this is the jquery script to parse json i use in a web.
You can see there are three id objects:
#searchb button tag
#searchResutls Div where contain the results
#searchs Input for text to search.

You must replace URL for your own url link to sphider.

<script>
function searchPages(link){
	$("#searchResutls" ).hide();
	$("#searchResutls" ).html("" );
	$("#searchResutls" ).html("<div class='searching'>Searching</div>" );
	$("#searchResutls" ).show();
	$.getJSON("URL"+link+"&jsoncallback=?", function(data){
		txt="";
		if(data.result_report!=undefined)
			txt+="<div class='report'>"+data.result_report+"</div>";
		
		$.each(data.results, function(i,item){
			if(item.num!="-1" ){
				txt+="<a href='"+item.link+"' class='row searchResult'>";
				txt+="	<div class='num'>"+item.num+"</div>";
				txt+="	<div class='searchContent'>";
				txt+="		<div class='searchTitle'>"+item.title+"</div>";
				txt+="		<div class='searchDescription'>"+item.description+"</div>";
				txt+="		<div class='searchMetadata'>"+item.link2+" - "+item.size+" - "+item.weight+"</div>";
				txt+="	</div>";
				txt+="</a>";
			}
		})
		if(data.other_pages!=undefined){
			txt+="<ul class='searchPages row'>";
			$.each(data.other_pages, function(i,item){
				txt+="<li><a href=\"javascript:searchPages('"+item.link+"');\" class='"+item.active+"'>"+item.title+"</a></li>";
			})
			txt+="</ul>";
		}
		$("#searchResutls" ).hide();
		$("#searchResutls" ).html("" );
		$("#searchResutls" ).html(txt);
		$("#searchResutls" ).slideDown("slow" );
	});
	
}
$(document).ready(function(){
	$("#searchb" ).click(function(){
			$("#searchResutls" ).hide();
			$("#searchResutls" ).html("" );
			$("#searchResutls" ).html("<div class='searching'>Searching</div>" );
			$("#searchResutls" ).show();
			$.getJSON("URL/search.php?query="+$("#searchs" ).val()+"&search=1&jsoncallback=?", function(data){
				txt="";
				if(data.result_report!=undefined)
					txt+="<div class='report'>"+data.result_report+"</div>";
				
				$.each(data.results, function(i,item){
					if(item.num!="-1" ){
						txt+="<a href='"+item.link+"' class='row searchResult'>";
						txt+="	<div class='num'>"+item.num+"</div>";
						txt+="	<div class='searchContent'>";
						txt+="		<div class='searchTitle'>"+item.title+"</div>";
						txt+="		<div class='searchDescription'>"+item.description+"</div>";
						txt+="		<div class='searchMetadata'>"+item.link2+" - "+item.size+" - "+item.weight+"</div>";
						txt+="	</div>";
						txt+="</a>";
					}
				})
				if(data.other_pages!=undefined){
					txt+="<ul class='searchPages row'>";
					$.each(data.other_pages, function(i,item){
						txt+="<li><a href=\"javascript:searchPages('"+item.link+"' );\" class='"+item.active+"'>"+item.title+"</a></li>";
					})
					txt+="</ul>";
				}
				$("#searchResutls" ).hide();
				$("#searchResutls" ).html("" );
				$("#searchResutls" ).html(txt);
				$("#searchResutls" ).slideDown("slow" );
 			});
 			return false;
		});//End search click
});
</script>

Regards. David
Re: Json Theme. You can get sphider results with json.
January 17, 2010 08:11PM
I am wondering where do add this changes? Or, do we have to change the sphider.php? I hope I am not that late to ask.

Thanks.
Re: Json Theme. You can get sphider results with json.
January 24, 2010 10:03PM
How do add this changes???
thx.
Re: Json Theme. You can get sphider results with json.
June 25, 2010 06:48AM
This changes i tell is for the web, this is a javascript of your web to call shpider with results.
Re: Json Theme. You can get sphider results with json.
December 05, 2012 08:46AM
Really got the point.





______________________________________________________
http://www.mmoggg.de/
Sorry, only registered users may post in this forum.

Click here to login