How to add ad code in the top & bottom of "page"s?
My site's pages are made up of content-node-type:page. I want to add advertisement above the H1's(in the top of page) and in the bottom ie., just above the footer. Is there any trick beyond changing page.tpl? Will blocks do? But their width seem开发者_运维知识库 to be small. My site is this one
Well actually you can do it with a combination of both. First define new regions (call them top_ad and bottom_ad or similar) in your template definition file (template.info) as follows :
regions[top_ad] = Top ad bar
regions[bottom_add] = Bottom ad bar
Then add the following in your page template (page.tpl.php) where you want to display these :
<?php if ($top_ad): ?>
<div id="top-ad" class="...">
<?php print $top_ad; ?>
</div>
<?php endif; ?>
....
<?php if ($bottom_ad): ?>
<div id="bottom-ad" class="...">
<?php print $bottom_ad; ?>
</div>
<?php endif; ?>
Then just create 2 blocks containing the banner content and put them in the top and bottom ad bar region respectively.
精彩评论