One option is to use placeholders for the tile when you add the code into the blocks - something like #TILE#. Then in page process you set an array with the order your blocks are rendered:

$blocks = array('header','left sidebar','right sidebar','bottom sidebar');

Now loop though the blocks and replace that token.

$tileNo = 0;
foreach ($blocks as $block){
  while ($pos = stripos($vars[$block],'tile=#TILE#'){
        $tileNo++;
$vars[$block] = substr_replace($vars[$block], $tileNo, $pos + 5, 6); //Change 6 to the length of your token
    }
}


If you are dealing with multiple themes where the block order can change then the other option is to do this via output buffering. I used this method for a client on a Wordpress MU site a few years ago.

Jamie Holly
http://www.intoxination.net
http://www.hollyit.net


On 3/23/2010 9:22 AM, Ashraf Amayreh wrote:
What I need to do is pretty simple. Doubleclick is an AD service that works by placing javascript snippets at various locations in the page. I do that via blocks.

The javascript output contains an optional variable called tile that is used in the doubleclick backend for various things. The tile should be set on ads sequentially. so 1st banner that appears in HTML page should have tile=1, 2nd banner should have tile=2 and so on till the last banner inside the HTML.

If there's a better approach to implement this then I'm all open for suggestions :)

--
Best Regards,
Ashraf Amayreh
CEO | O-Minds
Cell. 962 78 8099997
Tel. 962 6 5655150
Fax. 962 6 5675150

o-minds.com <http://o-minds.com>
web development | web design
user experience | branding design

Reply via email to