Skip to content

Commit

Permalink
updated doco
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Nyeholt committed May 17, 2011
1 parent f794f39 commit 5ec9c70
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions README.md
Expand Up @@ -18,14 +18,39 @@ ItemSetField module from http://github.com/ajshort/silverstripe-itemsetfield
Add Add


`Object::add_extension('Page', 'AdvertisementExtension');` `Object::add_extension('Page', 'AdvertisementExtension');`
`Object::add_extension('SiteConfig', 'AdvertisementExtension');`


to your _config.php file. to your _config.php file.


In /admin, navigate to the "Ads" tab and create a new add. Navigate to the page you want the ad Note that ads are inherited hierarchically, so setting ads on the Site Config
to appear on and select the ad via the "Advertisements" tab. will mean those ads are used across all pages unless specified for a content
tree otherwise.


* Navigate to the "Ads" section
* Create some Advertisements
* If you want to group the ads in a collection, create an Ad Campaign. These in turn can be associated with a client.
* On the Advertisements tab of a page (or Site Config), you can select the individual ads (or campaign) to be displayed.
* In your page template, use the AdList collection to actually list out the Ads to be displayed. Use the "Me" or "SetRatioSize" helpers to output an image linked as needed for proper click tracking.

<% control SiteConfig.AdList %>
<div class="ad">
$Me
<!-- Or, to scale it appropriately -->
$SetRatioSize(120,80)

</div>
<% end_control %>

* You can have complete control over how things are output by referring to the ad's Image and Link accessors. Be aware that if you're going to manually output the link, to include a special attribute used if tracking ad views (eg Advertisement::$use_js_tracking = true). So, output something like

<a href="$Link" class="adlink" adid="$ID"><img src="$Image.Link" /></a>


Check the Advertisement class for more.


## TODO ## TODO


Add extension method and include for doing a rotating ad banner Add extension method and include for doing a rotating ad banner
across all pages. You can do these manually for now via Page_Controller across all pages. You can do these manually for now via Page_Controller
if you want. Just select all Ads and iterate the collection if you want. Just select all Ads and iterate the collection

0 comments on commit 5ec9c70

Please sign in to comment.