Recent Topics

1 Aug 17, 2004 21:45    

I'd seen on a few non b2evo blogs the option to "google it" in the comments/permalink/trackback section. Simply you would click this and it would go to google and look up the posts title. I wanted to do this with b2evo and found it was very easy to do, I post here if anybody else would like to know how.

In main.php, include the following code somewhere in the post where you would like the "google it" option:

 <a href="http://www.google.com/search?hl=en&amp;ie=UTF-8&amp;q=<?php $Item->title('','',false); ?>"onmouseover="window.status='Search Google For This Topic';return true;" onmouseout="window.status=' ';return true;" title="Search Google For This Topic">Google it!</a>

or without the mouseover:

<a href="http://www.google.com/search?hl=en&amp;ie=UTF-8&amp;q=<?php $Item->title('','',false); ?>" title="Search Google For This Topic">Google it!</a> 

You can see this in action at www.automateexcel.com

cheers.
mark

Code edited to correct a minor issue. --IZS

2 Aug 17, 2004 22:07

very nice. thanks for sharing it!

3 Aug 18, 2004 15:56

Yeah that is pretty cool! Thanks automateexcel
.

5 Aug 18, 2004 21:32

Oops. If you have link a url to your title this hack falls apart. I've not done any investigating as to why - just observed that it happens. If I stumble across a solution I'll post it here.

6 Aug 18, 2004 21:59

Change it from

$Item->title()

to

$Item->title('','',false)

to make it suppress the link.

I changed it in the code above.

7 Aug 18, 2004 22:06

Wow that was quick. It helps when you know what you're doing eh? I am happy to report that Isaac's patch has correctified the issue reported above.

8 Aug 19, 2004 07:36

Thanks all, and Isaac for the code udpate! :D

9 Aug 21, 2004 13:44

It is working great but I want to modify it, I want to use a clickable button anyone have an idea how to do this in PHP?

I have a button ready in my img folder

10 Aug 23, 2004 08:24

just a guess..

does it have to be a bonafide "button" or just a clickable image?

If a clickable image is the answer, replace Google It! with your <img src="googleit.gif"> code and that should do the trick.

11 Aug 23, 2004 21:40

If your image is in the img folder then you can use

<img src="<?php imgbase() ?>


Follow it with the name of the file only - the php deal will include the slash between /img and your file name.

14 Jan 30, 2005 23:26

Try this (non-mouseover version):

<a href="http://www.google.com/search?hl=en&amp;ie=UTF-8&amp;q=<?php urlencode($Item->title('','',false)); ?>"onmouseover="window.status='Search Google For This Topic';return true;" onmouseout="window.status=' ';return true;" title="Search Google For This Topic">Google it!</a>

15 Jan 31, 2005 12:55

Thankyou :D it is a nice little addition to my blog.

17 Jun 07, 2005 23:44

Very nice automateexcel, I see that you use google Adsense, and was wondering if you could intergrate this with the "Adsense for Search" part of google adsense?....... Basicly it just returns a custom google page, with sponsored links at the top.

Thanks for the mod :)

18 Jun 12, 2005 02:03

I made some modifications to the GoogleIt! hack if anyone is interested. I included the name of the blog in the search. It searches in this format: Your Blog Name - Your Post Title. I also changed the code so it searches within your site and has Google SafeSearch activated. The search results open up in a new window. Below is the new code: (replace yourdomain.com with your domain). The &bull; is if you want to place the code next to your comments, trackbacks, etc. in _main.php (at the bottom of each post)

&bull; <a href="http://www.google.com/search?hl=en&amp;ie=UTF-8&amp;q=<?php $Blog->disp('name', 'htmlhead'); ?> - <?php $Item->title('','',false); ?>&safe=strict&domains=yourdomain.com&sitesearch=yourdomain.com" target="_blank" onmouseover="window.status='Search Google For This Post';return true;" onmouseout="window.status=' ';return true;" title="Search Google For This Post">Google it!</a>

Original Code:

<a href="http://www.google.com/search?hl=en&amp;ie=UTF-8&amp;q=<?php $Item->title('','',false); ?>"onmouseover="window.status='Search Google For This Topic';return true;" onmouseout="window.status=' ';return true;" title="Search Google For This Topic">Google it!</a>

19 Jun 23, 2005 22:21

I know I'm pretty stupid, but I really can't figure out where you put this code. Any help would be appreciated as I'm new to this.

20 Jun 24, 2005 02:29

Look for the skins folder, select a skin folder (inside the skins folder) and open _main.php for editing. Look for the "Start of main area" and the "Start of posts" in _main.php. Look for this code several lines below:

<?php $Item->feedback_link( 'comments' ) // Link to comments ?>
<?php $Item->feedback_link( 'trackbacks', ' &bull; ' ) // Link to trackbacks ?>
<?php $Item->feedback_link( 'pingbacks', ' &bull; ' ) // Link to trackbacks ?>
<?php $Item->edit_link( ' &bull; ' ) // Link to backoffice for editing ?>
<?php $Item->trackback_rdf() // trackback autodiscovery information ?>
</div>

Place

&bull; <a href="http://www.google.com/search?hl=en&amp;ie=UTF-8&amp;q=<?php $Blog->disp('name', 'htmlhead'); ?> - <?php $Item->title('','',false); ?>&safe=strict&domains=yourdomainhere.com&sitesearch=yourdomainhere.com" target="_blank" onmouseover="window.status='Search Google For This Post';return true;" onmouseout="window.status=' ';return true;" title="Search Google For This Post">Google it!</a>

inbetween

<?php $Item->feedback_link( 'comments' ) // Link to comments ?>

and

<?php $Item->feedback_link( 'trackbacks', ' &bull; ' ) // Link to trackbacks ?>


That is where I have placed the Googleit! code. You can do as you please. Hope this helps

21 Sep 21, 2005 17:53

automateexcel wrote:

I'd seen on a few non b2evo blogs the option to "google it" in the comments/permalink/trackback section.

First off thanks for this great feature. I had been using it for a while and decided I wanted to have it adsense aware. So after much trial and error and learning a bit 'o PHP here are the results.

Note this code is designed to be run as a php include file (e.g. /includes/googleit.php), called from _main (for your skin) whereever you want the GoogleIt link to appear.

A lot of the options for google adsense search (like your id, the formatting of the results, etc.) are defined in variables ... so it should be fairly easy to customize to your need.

This is my first attempt at a hack (of a hack) so be gentle.

See it in action:[url=http://mrshiney.froppy.com/blog]Shiney Blog[/url]


<? php ;

// GoogleIt macro (originally by automateexcel http://www.automateexcel.com on b2evo forum) ;
// Hacked by Mr. Shiney <mrshiney@froppy.com> to include google adsense targeting ;
// Permission granted to reuse my paltry attempts if you credit me and original author ;

// This code should be called by php include code from _main for your skin where you want the GoogleIt link to appear ;

 //thelinkname can be changed to something other than GoogleIt ;

$thelinkname = "GoogleIt!" ;

 //thecof stores the formatting information - generate from your google adsense for search tab ;

$thecof = "GALT:#0066CC;GL:1;DIV:#999999;VLC:336633;AH:center;BGC:FFFFFF;LBGC:FF9900;ALC:0066CC;LC:0066CC;T:000000;GFNT:666666;GIMP:666666;FORID:1;" ;

 //theclient stores your clientID for google adsense ;
 //change to your google adsense ID ;

$theclient = "YOURID" ;

 //thewintitle is the title of the new window you want googleit to open

$thewintitle = "GoogleIt" ;


 // convert spaces for search string to make google happy ;
 
$thetitle=str_replace(" ","%20+",$Item->title);
// $thetitle=str_replace(" ","%20+",$Item->title('','',false));


 ?>
  
<a href="http://www.google.com/custom?q=<?php echo $thetitle ?>&sa=Search&client=<?php echo $theclient ?>&forid="1"&ie="ISO-8859-1"&oe="ISO-8859-1"&cof=<?php echo $thecof ?>&hl="en" TARGET=<?php echo $thewintitle ?> onmouseover="window.status='Search Google For This Topic';return true;" >
<?php echo $thelinkname ?></a>

22 Nov 29, 2005 09:22

Not trying to spoil the fun - this feature is great, but isn't it against Terms & Conditions of Adsense for Search?

AdSense for Search. If You have elected to receive Search Results, You will display on Your Site(s) a Google search box (a "Search Box") in accordance with the specifications provided by Google. Each Web page(s) that contains a Search Box must also contain other content related to Your Site. Except for related Google queries, all search queries (including queries entered into an Ad search box) must originate from individual human end users inputting data directly into a Search Box (or Ad search box, as applicable) on Your Site(s). You will send any and all queries (without editing, modifying, or filtering such queries individually or in the aggregate) to Google and Google will use commercially reasonable efforts to provide You with corresponding Search Results and/or Ads, as applicable and as available. Search Results and any accompanying Ads will be displayed on Web pages hosted by Google (each, a "Search Results Page"), the format, look and feel of which may be modified by Google from time to time.


Form is loading...