We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Custom banner placement and logic | Forum

Sebastian
Sebastian Oct 2 '13
Hi!


Just giving something back to the community :-)


If you want to have a little more control with the ads on your site, have all look at that simple example. Might be useful for some custom code junkies ;-)


vi ow_core/master_page.php / top of document

// Count requests

if( isset ($_SESSION["bcountbase"])){$_SESSION["bcountbase"] = $_SESSION["bcountbase"]+1;}else{$_SESSION["bcountbase"] = 1;}


vi ow_core/application.php

Right after $viewRenderer->assignVar('adminDashboardIframeUrl',..........


// Config bannercode

$CFG_wideskyscraper = array("<a href=\"http://www.charitywater.org/whywater\"><img src=\"http://www.charitywater.org/media/banners/160x600_jerry.jpg\" width=\"160\" height=\"600\"/></a>","<a href=\"http://my.charitywater.org\"><img src=\"http://www.charitywater.org/...x600__mycw_beard.jpg\" width=\"160\" height=\"600\" /></a>","<a href=\"http://www.charitywater.org/donate\"><img src=\"http://www.charitywater.org/.../160x600_present.jpg\" width=\"160\" height=\"600\" /></a>");



// Evaluate banner display

if ($_SESSION["bcountbase"] < 11){            $TPL_widesyscraper = $CFG_widesyscraper["0"];

}


 if ($_SESSION["bcountbase"] >= 11 && $_SESSION["bcountbase"] < 20){            $TPL_widesyscraper = $CFG_widesyscraper["1"];

}


  if ($_SESSION["bcountbase"] >= 20){            $TPL_widesyscraper = $CFG_widesyscraper["2"];

}


// Assign banners

$viewRenderer->assignVar('TPL_widesyscraper', "$TPL_widesyscraper");




edit template to display on sidebar for example:

vi ow_system_plugins/base/views/components/sidebar.html


{foreach from=$componentList item="component" name=sbfix}    {sb_component uniqName=$component.uniqName}    {if $smarty.foreach.sbfix.first}    <div align="center">{$TPL_wideskyscraper}</div>    <BR><BR>    {/if}{/foreach}


First 10 clicks of user will display bannercode A, second 10 clicks will display bannercode B etc....


Enjoy!


Sebastian


The Forum post is edited by Sebastian Oct 2 '13