Archived : Techno Babble

This is the archived version of my b2evolution code blog.
If you require any help regarding b2evolution then
visit it's support forums

You can find my current blogs here
Code : {@link : WafflesOn}
Personal : {@link : InnerVisions}

« Link your wordsNested comments »

Playing with clouds

Posted on 23rd Apr 2007 in : Plugins & Widgets

Yay I got a Zeitgeist ........ whatever the hell one of them is .... personally I call it a search cloud, it's far easier to spell :| In the true spirit of OpenSourceSoftware I stole the idea off Whoo and decided to see how easy it would be to create a b2evolution plugin that did the same thing. It's probably taken me longer to write this post than it took to code it :p

How does it work ?

It's pretty simple really, the plugin scurries through your hitlog and finds all of the hits that have been flagged as coming from a search engine. It takes all these hits and meanders off to count them, grabs a beer and a smoke and then ambles back with a cloud ready to be slapped on your blog. If it's enabled then you should see a cloud below the first post on the first page of my blog, the font-size indicates how often that search term was used to find my tacky lil pad :D

If any of you fancy having a pre-release play with it then you can steal it from here (we've now released version 1.0 of the plugin on Sourceforge ), unzip/upload/install it and then add the following skintag to your skins _main.php

Code:

$Plugins->call_by_code( 'am_srchcloud', array() );

You can pretty much throw that anywhere in your skins main, even inside your post loop as it defaults to only showing once per page. There's a couple of parameters you can use :

  1. blog : spookily enough this is the blog ID that you want to show the cloud for. The default is to use the current blogs id. If you set it to 1 then it will show all hits for all blogs
  2. show_once : by setting this to false you can display more than one cloud, the default is to only show once

If you want to play with the styling then just take a root around in the plugins source and you'll see all the classnames it uses, you can even play with the html it produces to bend it to your will. The chances are that most of that bit will become params by the time the release version comes out.

That's pretty much it really. As always if you find any bugs or want to send me the odd million quid then feel free to leave a comment
¥

*edit* 29th April

This plugin has how been released on Sourceforge, unfortunately we forgot all about the help file so here's a quick rundown of all the parameters

*edit*4th May

We've now released version 1.1, which actually has a semi-useful helpfile ;) ... you can read all about it on AstonishMe

9 comments

Comment by The Virtual Ranger { @link http://naturenet.net/blogs } on 28/04/07
After gawping jealously at Whoo's clouds of glory I screwed up my eyes and wished that someone would make something like that for b2evo. Imagine my delight, etc. Nice one. I tried it out on my main blog in the sidebar and it's devastatingly simple & effective. Well written too so even a numpty like me can understand it. Will need me to do some skin mods for me to use properly so I'll wait a bit for next iteration maybe as I'm too idle to do it twice. Meanwhile, fancy some feedback? From the mundane to the wildly optimistic.
- Like to be able to limit number of items shown, showing top n most interesting or recent
- Looks like the list is dynamically calculated, so is there likely to be a performance hit on well-used sites? Any chance of it ever being cached, refreshed every 30 mins or something?
- Some search terms are stupidly long, can they be optionally truncated?
- Obscenity filter? Amazing how often my blog gets hit for 'weird sex'. Ahem.



What should we do with spammers? You want to stone them
Comment by ¥åßßå on 28/04/07
Lol, ooops, I suppose I should have posted an update :p

We've actually been working on this in svn and have released a version of it that has a limit, and a few more parameters. We'll be implementing a cache in the next version although we'd been toying with a 24 hour cache ..... guess I'll make it a setting and then everybodys happy.

I think I could probably do with the obscenity filter myself, there seems to be a fair few searchers that misunderstand the sort of pumps I tend to babble about :P

The evocore already limits each individual search word ( to 10 chars I think ), but it wouldn't be to hard to also build in a total length ... guess that'll be another setting.

If you want to grab the release version you can get it from Sourceforge, unfortunately, being the blonde that I am, I forgot all about the help file until after I packaged up the release, so you'd need to look at the source to get all the parameters .... hopefully they'll make sense to non-blondes as well .... note to self, nag Scott to do the help file :p

Thanks a lot for the feedback, it's always invaluable :D

¥

What should we do with spammers? You want to play with them
Comment by The Virtual Ranger { @link http://naturenet.net/blogs } on 28/04/07
Nice, that's even better. I tried this version too - it has much promise. I shall keep my eye on this one. Cheers.

What should we do with spammers? You want to hang them
Comment by ¥åßßå on 04/05/07
We've now released version 1.1 which has a cache, word filter and a term length setting. You can grab it from the same link ;)

¥

What should we do with spammers? You want to play with them
Comment by The Virtual Ranger { @link http://naturenet.net/blogs } on 17/06/07
Yay! Now I have my very own cloud. Nice. And with the options I suggested... now I'm pathetically grateful. Thanks a lot for this plug-in. Thanks also for the crystal documentation - easiest plug-in I've dealt with for a while. You can see it working at the bottom of my main sidebar.

Now, my query (you knew there would be one huh?) is this. I've set the order to desc (after trying them all), and I notice the top item showing is not the most popular, as the biggest item is a little way down the list. And changing the number of searches shown does change the order a bit as new items come and go. When rand is not selected is there still any randomisation when the list is displayed, and if so can we turn it off? I'd like to show a 'Top of the Pops' style league table, ideally.

What should we do with spammers? You want to play with them
Comment by The Virtual Ranger { @link http://naturenet.net/blogs } on 17/06/07
Doh. OK, I've just got it. It's alphabetical. It was 'Zina Saro-wiwa' that give me the clue. So forgive and forget my ramblings above if you will. But still, any chance of having it in asc/desc order of popularity, as opposed to alphabet?

What should we do with spammers? You want to play with them
Comment by ¥åßßå on 18/06/07
Lol, give you an inch and you want a mile :p

If you amend this bit of code ( to add the /* .......... */ ) then it'll show you the cloud in highest -> lowest order.

/*
switch( $params[ 'order' ] )
{
case 'asc' :
ksort( $search_stats );
break;

case 'desc' :
krsort( $search_stats );
break;

default:
shuffle( $search_stats );
}
*/

¥

What should we do with spammers? You want to play with them
Comment by The Virtual Ranger { @link http://naturenet.net/blogs } on 18/06/07
Bullseye. Thanks, Yabba. It's now just as I want it. :)

What should we do with spammers? You want to play with them
Comment by ¥åßßå on 19/06/07
really? When I last looked the cloud wasn't being carried towards me by a lightly clad, well developed blonde with low morals :(

Of course I'm now gonna have to code that into the next version ...... not the blonde, I'm not that good :p

¥

What should we do with spammers? You want to play with them
Page archived : 20th Dec 2009
 

X