Thread:Project:Support desk/Where do I put Google AdSense code in Vector.php for a banner ad at the top?/reply (9)

What should the code, which you posted, do? Where did you put these lines? There should be functions in LocalSettings.php, but the code you posted is JavaScript, or - as a PHP programmer would say: A syntax error. And how should things work together? Your hook definition does not call the function, which you have defined. Looks all very strange...

Basically this should work - in LocalSettings.php to be sure:

$wgHooks['BeforePageDisplay'][] = 'addGoogleAdSense'; function addGoogleAdSense( OutputPage &$out, Skin &$skin ) { $adSenseCode = 'foo bar'; // add the content of the script tag (not also the script tag itself!) of your JavaScript here. $out->addInlineScript( $adSenseCode ); // Do the same again, if you still need another script...  // After you did it wrong, think about it yourself and fix it. return TRUE; // ohh yeah! }

That should give you an idea of how to really use hooks.