dev-master
9999999-dev https://github.com/dbtlr/NodrewDfpBundleSymfony2 Bundle for integrating with the Google DFP Ad Network.
MIT
The Requires
- php >=5.3.2
- symfony/symfony >=2.0,<2.4-dev
by Drew Butler
google advertising dfp
Symfony2 Bundle for integrating with the Google DFP Ad Network.
Ultimately, the NodrewDfpBundle files should be downloaded to the
vendor/bundles/Nodrew/Bundle/DfpBundle
directory., (*1)
This can be done in several ways, depending on your preference. The first method is the standard Symfony2 method., (*2)
Using the vendors script, (*3)
Add the following lines in your deps
file:, (*4)
[NodrewDfpBundle] git=http://github.com/nodrew/NodrewDfpBundle.git target=/bundles/Nodrew/Bundle/DfpBundle
Now, run the vendors script to download the bundle:, (*5)
``` bash $ php bin/vendors install, (*6)
**Using submodules** If you prefer instead to use git submodules, then run the following: ``` bash $ git submodule add http://github.com/nodrew/NodrewDfpBundle.git vendor/bundles/Nodrew/Bundle/DfpBundle $ git submodule update --init
``` php // app/autoload.php, (*7)
$loader = new UniversalClassLoader(); $loader->registerNamespaces(array( // ... 'Nodrew' => DIR.'/../vendor/bundles', ));, (*8)
### Step 3: Enable the bundle Finally, enable the bundle in the kernel: ``` php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Nodrew\Bundle\DfpBundle\NodrewDfpBundle(), ); }
``` yaml, (*9)
nodrew_dfp: publisher_id: [publisher_id], (*10)
### Step 5: Add Control Code Placeholder to layout This placeholder comment needs to be added to the head of your layout. It is automatically replaced with the proper Google DFP code, when ads are used on the given page. ``` html // app/views/base.html.twig <head> ... <!-- NodrewDfpBundle Control Code --> </head>
To use a standard in page ad unit, add the following to your template:, (*11)
``` html {{ dfp_ad_unit('some/campaign', [300, 250]) }}, (*12)
The appropriate control codes will be added to the header, if everything was done correctly during setup. ### Out of page unit. If you're looking to do a DFP out of page unit, such as an interstitial, or a skin, then use this code. It is much similar, just without the size attached to it. ``` html {{ dfp_oop_ad_unit('some/campaign') }}
The appropriate control codes will be added to the header, if everything was done correctly during setup., (*13)
Symfony2 Bundle for integrating with the Google DFP Ad Network.
MIT
google advertising dfp