Top.Mail.Ru
? ?

The S2 HowTo Journal

Tips, Tricks, and Tutorials for Basic S2 Customization

[paidaccount] How to display AdSense in custom styles
howto_user wrote in s2howto
Paid Accounts Only
The following tutorial requires creating and editing a custom style, which in turn requires a paid, permanent, or early adopter account. Please read What are the paid account benefits? and How do I buy a paid account? to learn about the paid account benefits and how to buy a paid account.

If you have your journal style customized, to display Your Journal - Your Money ads on your journal pages, you need to call the print_ad_box("type") method of the Page class in the code of your layout layer. Where 'type' is defining ad format as follows:

s2.top728x90 Top
s2.vertical160x600
s2.box.top300x250
s2.bottom728x90 Bottom

To add html code around the ad block, viewer_sees_ad_box("type") clause could be used. Where 'type' is an appropriate banner value.

Example

The following code could be used to display the 728x90 Bottom banner:

var Page p = get_page();
if (viewer_sees_ad_box("s2.bottom")) {
   "<div class=\"ad\">";
   $p->print_ad_box("s2.bottom");
   "</div>";
}

Contributed by arteman.