how to enable adsense code in page.tpl?
Posted June 12th, 2008 by paolo
hello, new in drigg, looks great but I have some issues to fix:
in page.tpl file there are 2 lines about adsense one for 468x60 and another one for 120x600, well, I'd like to use my own banners, so this is the question: how to enable them? php line starts with an "if", so there must be some place where to enable ads
I'm having the same problem.
I'm having the same problem. I went to User Management > Access Control and verified that "digg ad free site" is not enabled for any type of user. I'll probably end up just removing the if statements, but it would be nice to know where this "show_ads" condition can be enabled/disabled.
Problem with the theme
Hi,
The variable show_ads is NEVER true, and cannot be true. This is a bug with the theme.
The variable needs to be set in template.php, throug hthe $vars[] array. I am not sure how this went unnoticed for so long.
If you manage to fix template.php, please send a patch over here. Adding a line of code is one second -- however, it would be nice if you could add it, and test it to make sure everything is good.
The line should be something like:
$vars['show_ads']= !user_access('digg ad free site');
To be added under
$node=$vars['node'];
Please let me k now if it works -- if it does, I will add it to the default theme.
Merc.
one step closer, but not fixed
I don't have immediate plans to make the site ad-free for different types of users, so I just inserted my ads without the if statements.
I did go ahead and test....
Once I added
$vars['show_ads']= !user_access('digg ad free site');to template.php, content within the if statement would show.
HOWEVER, whether or not "digg ad free site" was checked or not checked in the admin panel did not make a difference.
Permissions
Look in the permissions for modules. I believe there is a section that says view ad free site etc. Just enable it appropriately. However, I think I saw somewhere that Merc left those in/the adsense code by accident. If you want to enable the ads for everyone, just replace the existing code with your own, remove the php if tags and they should appear.
Hope that helps.
Regards,
John
http://www.designbump.com
P.S. Merc, if you are reading this, I am going to email you about the drigg box clarification soon. I have just been swamped lately.
Thanks a lot...
Hi,
Thanks a lot John. I've applied the patches for the drigg box.
Also... the "ad free site" was left in the module by accident, but a lot of people found it very useful. So, I left it there!
Merc.
My concern is that Google
My concern is that Google only allows ads on content pages. If Google ads are displayed on login pages and such then your account can get banned. Is there any way we can check for this before showing ads?
I have seen...
Hi,
I have seen _major_ sites with Google ads in Login pages, and nobody ever blinked.
If you are super-concerned, please ask the Drupal forum. They will tell you what to do -- sorry, I don't have the resources to provide generic Drupal help!
Bye,
Merc.