Ads code placement

To place ads in either left_side bar or right_sidebar and in the main_content site wide:

views\default\canvas\layouts:  Exampleof - two_column_left_sidebar;

<!-- left sidebar -->
<div id="two_column_left_sidebar">


            echo elgg_view('page_elements/owner_block',array('content' => $vars['area1']));

     <!-- add notes to site here -->
    <?php if (isset($vars['area3'])) echo $vars['area3']; ?><br>
      <p align="center"><script type="text/javascript"><!--
google_ad_client = "xxxxxxxxxxxxxx";
/* 160x600, created 4/7/09 */
google_ad_slot = "xxxxxxxxx";
google_ad_width = 160;
google_ad_height = 600;
<script type="text/javascript"
</script> </p><br>
</div><!-- /two_column_left_sidebar -->

<!-- main content -->
<div id="two_column_left_sidebar_maincontent">
<script type="text/javascript"><!--
google_ad_client = "xxxxxxxxxxxxxx";
/* 728x90, 7/18/09, Main_Content */
google_ad_slot = "xxxxxxxxxxxx";
google_ad_width = 728;
google_ad_height = 90;
<script type="text/javascript"
<?php if (isset($vars['area2'])) echo $vars['area2']; ?>

</div><!-- /two_column_left_sidebar_maincontent -->


The placement above will insert a banner over ALL main content except "The wire".  The wire requires a different edit.  This example will also place a skyscraper banner in the left sidebar.  This edit will save time in adding code to each plugin.  I have tested and I am useing this, releveant ads DO follow content of page nicely.

  • Thanks, goofbucket. It's quite an useful piece. I Wonder why no responses to it.

  • @woodpecker actually I put this same post up in a number of location.  It was in responce to the idea that someone was putting out that you had to edit in your ad code into every individual plugin, i.e. groups, blogs, videos, photo's, etc. etc.  

    The true idea nearly as I can make out is the make elgg as simple and user friendly a possible.  So even administrators can just install add the plugins they want and walk away.  Both the person saying add code to each plugin and mine above do not really help with this idea.  However for some, more commercial minded developers I thought this would be much simpler then editing every individual plugin.

  • Wow, that's exactly what I wanted to do!!

  • I found that this placed ads on these pages: Blogs, Bookmarks, Files, Friends, Pages, Photos, The Wire, Videos - all of which I think are plugins.

    For the Activity, Members, and Groups pages - which are not pugins, I modified the file sidebar_boxes.php similarly.