You are here

dynamic_banner_template.tpl.php in Dynamic Banner 6

This file will determine how the dynamic banner block will display

You can import this file into your theme to override this one Feel free to hack this up in your theme even if you only leave one case in it should still work just remember that when you go to extend the banner

File

dynamic_banner_template.tpl.php
View source
<?php

/**
 * @file
 * This file will determine how the dynamic banner block will display
 * 
 * You can import this file into your theme to override this one
 * Feel free to hack this up in your theme even if you only leave one case in 
 * it should still work just remember that when you go to extend the banner
 */

// add a dynamic css file definition which will load from the same directory
drupal_add_css('dynamic_banner.css');

// input variables need to have the same name as the theme definitions
// Url
$url;

// Text (optional)
$text;

// Link (optional)
$link;

// display setting
$display_setting;

// display errors
$display_errors;
?>

<?php


// decide how to output based on what the displaysetting is
if ($display_setting == 'urltext') {

  // check for variables that are about to output
  if ($url && $text) {
    ?>
    <div id="banner-left">
      <img src="/<?php

    print $url;
    ?>" class="jpg" alt="banner" width="596" height="209" />
    </div>
    <div id="banner-right">
      <p id="bannerTitle"><?php

    print $text;
    ?></p>
    </div>
  <?php

  }
  elseif ($display_errors) {
    drupal_set_message(t("Dynamic Banner Error Detected: Using mode urltext"), 'error');
  }
}
elseif ($display_setting == 'url') {
  if ($url) {
    ?>
    <div id="banner">
      <img src="/<?php

    print $url;
    ?>" class="jpg" alt="banner" width="596" height="209" />
    </div>
  <?php

  }
  elseif ($display_errors) {
    drupal_set_message(t("Dynamic Banner Error Detected: Using mode url"), 'error');
  }
}
elseif ($display_setting == 'text') {
  if ($url) {
    ?>
    <div id="banner">
      <p><?php

    print $text;
    ?></p>
    </div>
  <?php

  }
  elseif ($display_errors) {
    drupal_set_message(t("Dynamic Banner Error Detected: Using mode text"), 'error');
  }
}
elseif ($display_setting == 'urllink') {
  if ($url && $link) {
    ?>
    <div id="banner">
      <a class="link" href="/<?php

    print $link;
    ?>"><img class="jpg" alt="banner" src="/<?php

    print $url;
    ?>"></a>
    </div>
  <?php

  }
  elseif ($display_errors) {
    drupal_set_message(t("Dynamic Banner Error Detected: using mode urllink"), 'error');
  }
}