Download the PHP package snapshotpl/zf-snap-google-adsense without Composer
On this page you can find all versions of the php package snapshotpl/zf-snap-google-adsense. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download snapshotpl/zf-snap-google-adsense
More information about snapshotpl/zf-snap-google-adsense
Files in snapshotpl/zf-snap-google-adsense
Package zf-snap-google-adsense
Short Description Google Adsense view helper for Zend Framework 2
License
Homepage https://github.com/snapshotpl/ZfSnapGoogleAdSense
Informations about the package zf-snap-google-adsense
ZfSnapGoogleAdSense
Google AdSense view helper for Zend Framework 2
Module helps to manage yours AdSense units on page. Keep them all in one place and use renderers!
The simplest usage
Add ad unit (one or more) and publisher ID (you can find it here) to your config:
And then render ad in your view by view helper. You can use googleAdsense or adsense name:
That's all! In default adsense use asynchronous code. You can change it by using predefined view renderers.
How to install?
Via composer.json
Renderers
You can use renderes (by implements ZfSnapGoogleAdSense\View\Helper\Renderer\RendererInterface
) to render your ads. In default module provides simple view renderer with very useful views:
- asynchronous (default): official asynchronous script,
- synchronous: official synchronous script,
- placeholdit: fake placeholer is using placehold.it service to generate image, perfect for dev or test eviroments, you can customize it, to details see
config/module.config.php
and overwrite options, - html: generates html div, perfect for dev or test eviroments, you can customize it, to details see
config/module.config.php
and overwrite options,
To add own view to view render create view (in view you can use ad
property which it's instance of \ZfSnapGoogleAdSense\Model\AdUnit
by default) add it to view_manager with prefix zf-snap-google-adsense-renderer-view-*
:
To change current view renderer pass view name to renderer
option:
If you wrote your own renderer pass intance name from service_manager
. You can also set custom parameters into view. To see how it works look into renderers
array in config/module.config.php
and view renderers source.
Options
ads
defines ad units
- id (required): Ad ID,
- size (required): You can define size by string or array,
- type: content and link. Content unit is default. You can use constats or strings,
- name: It's used in custom renderes (placeholdit and html). If name is not defined, ad gets name by key name,
enable
if equals false
, than disable ads on page.
publisher-id
(required) publisher ID - you can find it here
unit-limit
limits ads on page. Default values: