Display Ads Between Posts in Drupal
Keywords:
26
Jun
2010
You have probably noticed that many websites tend to display advertising between posts, surrounded by relevant content.
Achieving this in Drupal is a trivial task. All you need to do is place the following code to the top of the node.tpl.php for whatever theme you are running.
If you are using custom_content and customizing it differently using a node-custom_content.tpl.php, don't forget to add the code to the node-custom_content.tpl.php as well.
<?php if ( !$page && ($id == 2 || $id == 4)) : ?>adsense code goes here<?php endif; ?>This will add the adsense code after the 2nd and 4th post. You may want to adjust this accordingly.
About Us
NZ Web Hosting Internet Technolgies Blog.
Website design, website development, promotion and search engine optimisation.
