(REQ)vB Ad Management 3.1

How to add your own custom adcode blocks in 3 minutes

Download the zip file and open the named php files using a plain text editor (something like MSWord which uses formatting will break the code). Follow the simple instructions below then save, upload and overwrite your existing files. Your new custom adcode block will be at the bottom of the header/footer section of your vB Ad Management settings.

You can add as many custom blocks as you like as long as you give each one a different name. They'll work on any page, obey all permissions and work with all features including Ad-Sharing.

To name a custom adcode block, just find/replace every instance of the word "custom" in the code below with the new name of your choice.



IN FILE vb_ad_management_3xx.xml, FIND:

PHP:
<template name="footer_advertisement" templatetype="template"><![CDATA[ 
        <div align="center"> 
            $footer_adcode 
        </div> 
]]></template>

ADD BELOW:

PHP:
<template name="custom_advertisement" templatetype="template"><![CDATA[ 
        <div> 
            $custom_adcode 
        </div> 
]]></template>

---------

FIND:

PHP:
<setting varname="adintegrate_footer_adcode_rand" displayorder="45"> 
    <datatype>free</datatype> 
    <optioncode>textarea</optioncode> 
</setting>

ADD BELOW:

PHP:
<setting varname="adintegrate_custom_onoff" displayorder="991"> 
    <datatype>boolean</datatype> 
    <optioncode>yesno</optioncode> 
    <defaultvalue>0</defaultvalue> 
</setting> 
<setting varname="adintegrate_custom_adcode" displayorder="992"> 
    <datatype>free</datatype> 
    <optioncode>textarea</optioncode> 
</setting> 
<setting varname="adintegrate_custom_adcode_rand" displayorder="993"> 
    <datatype>free</datatype> 
    <optioncode>textarea</optioncode> 
</setting>

-------------

IN FILE includes/vb_ad_management/cache_templates.php, FIND:

PHP:
if ($vbulletin->options['adintegrate_footer_onoff']) 
{ 
    $adtemplates[] = 'footer_advertisement'; 
}

ADD ABOVE:

PHP:
if ($vbulletin->options['adintegrate_custom_onoff']) 
{ 
    $adtemplates[] = 'custom_advertisement'; 
}

------------------------

IN FILE includes/vb_ad_management/global_start.php, FIND:

PHP:
if ($vbulletin->options['adintegrate_footer_onoff'])

ADD ABOVE:

PHP:
if ($vbulletin->options['adintegrate_custom_onoff']) 
{     
    if ($vbulletin->options['adintegrate_custom_adcode']) 
    { 
        $custom_split = explode("$adshared", $vbulletin->options['adintegrate_custom_adcode']); 
        $custom_adcode = $custom_split[0]; 
        if ($custom_split[1]) 
        { 
            $custom_adcode = $custom_split[0] . $GLOBALS['adcode_shared'] . $custom_split[1]; 
        } 
        eval('$custom_advertisement = "' . fetch_template('' . custom_advertisement . '') . '";'); 
    } 
    else if ($vbulletin->options['adintegrate_custom_adcode_rand']) 
    { 
        $custom_adcode = explode("$addelimiter", $vbulletin->options['adintegrate_custom_adcode_rand']); 
        $custom_rand = array_rand($custom_adcode); 
        $custom_adcode = $custom_adcode["$custom_rand"]; 
        $custom_split = explode("$adshared", $custom_adcode); 
        $custom_adcode = $custom_split[0]; 
        if ($custom_split[1]) 
        { 
            $custom_adcode = $custom_split[0] . $GLOBALS['adcode_shared'] . $custom_split[1]; 
        } 
        eval('$custom_advertisement = "' . fetch_template('' . custom_advertisement . '') . '";'); 
    }     
}
 
Back
Top