Created
May 19, 2009 17:16
-
-
Save dawehner/114230 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// load the fields into an array so we can easily grab any piece we want | |
// 0 - image URL | |
// 1 - HTML link to node | |
// 2 - external link | |
//print count($fields); | |
foreach ($fields as $id => $field): | |
$item[] = $field; | |
endforeach; | |
// strip HTML from default output | |
$imgURL = preg_replace('/<\/?.*?>/','',$item[0]->content); | |
$resourceURL = preg_replace('/<a href="(.*?)">.*?<\/a>/','$1',$item[1]->content); | |
// banner ad output | |
if ($item[2]->content) { | |
$imgTag = "<a href='{$item[2]->content}' target='_blank'><img src='$imgURL' alt='' /></a>"; | |
} | |
elseif ($resourceURL) { | |
$imgTag = "<a href='$resourceURL' target='_blank'><img src='$imgURL' alt='' /></a>"; | |
} | |
?> | |
<div class="banner-ad"> | |
<div class="caption">advertisement</div> | |
<?php print $imgTag ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment