How to Add Google Adsense by Templates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ComputerVitals
    Senior Member
    • Oct 2005
    • 541
    • 3.8.x

    How to Add Google Adsense by Templates

    Lets say I wanted to make a google adsense code template so I wouldn't have to put in the adsence code everywhere.
    Here's how.
    Step 1
    Styles and Templates --> Style Manager -->
    Select your style --> Add new Template

    Title: google
    Template:
    Code:
    <script type="text/javascript"><!--
    google_ad_client = "[i]your adsence id here[/i]";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "image";
    google_ad_channel ="";
    google_color_border = "3E5C92";
    google_color_bg = "BBC7CE";
    google_color_link = "000066";
    google_color_url = "22229C";
    google_color_text = "22229C";
    //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    Save and exit

    Step 2
    Plugin Manager --> Add New Plugin
    Product: vBulletin
    Hook: vbulletin:General -- parse_templates
    Title: google adsence
    Excution: 5
    Plugin php code:
    Code:
    eval('$google = "' . fetch_template('google') . '";');
    Step 3
    Add: $google
    to the templates where you would like the code to be displayed.
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 73976

    #2
    Probably want a second plugin on global_start to prevent an extra query on every page.

    Hook: vBulletin: General -- global_start
    Title: Cache Google Template
    Plugin php code:
    PHP Code:
     global $globaltemplates;
     
    $globaltemplates array_merge($globaltemplates, array('google')); 
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment

    Related Topics

    Collapse

    Working...