I was expecting that if I copied the banner_output_template.tpl.php file into my theme I would be able to override the output. This is not the case. It is necessary to change the template file because the default has hard-coded image widths, heights and other elements that are likely not needed by most. I'd either like to suggest making override possible, or cleaning up the core template file to be generic & not include these hard-coded items.

Comments

coolestdude1’s picture

Roger that, the template file is supposed to be overwritten by the user but I agree it should go in your theme so that the module can update without you having to worry. I need to poke around a bit so as to get this in the next release.

coolestdude1’s picture

Ok to answer these lingering questions,

I took out the fixed widths/heights from the output make sure you set them somewhere with css in your theme by targeting the banner ids.

Since the banner outputs all of the banners in a block you should be able to do a block.tpl.php for this to override it further.

You are also always welcome to suggest things in feature requests here for changes to that versioned file. Or keep an altered one in your module folder and same goes for css. Always keep a backup to update to the latest copy.

The template file is loaded from the theme function hook in the .module you could also alter this file personally to load your own template in your theme then just use the provided variables to accomplish the same thing. Hope that helps.

altrugon’s picture

Hi there,

First of all thank you for your work, I know to create and maintain a module is not an easy task.

I basically run into all the problems listed on your issue queue with the recommended release version so I tried to use your dev branch and finally I was able to see some output. However this also require some work and one of them was to make sure my image was the right size, which require to override your template and doing this I found another issue.

The template file is named banner_output_template.tpl.php but in your theme function you have gave another name to the theme function:

/**
 * Implements hook_theme().
 * theme template used in module.
 */
function dynamic_banner_theme() {
  $theme = array(
    'banner_output' => array(
      'variables' => array(
        'url'             => NULL,
        'text'            => NULL,
        'link'            => NULL,
        'display_setting' => NULL,
        'display_errors'  => NULL,
      ),
      'path'      => drupal_get_path('module', 'dynamic_banner') . '/templates',
      'template'  => 'banner_output_template',
    ),
  );

  return $theme;
}

This means that if you try to copy the template into your own theme it will never be called at least you rename it to banner_output.tpl.php

I would suggest to remove "_template" from this equation.

Thanks.

coolestdude1’s picture

Agreed I need to look this over thoroughly because I have seen a module that does this really well that I would like to take a chunk of and implement. This of course will take me a bit of time as this is my companies most busy time of year but alas I will try to be as active as possible for everyone. Sorry about the lag time hopefully soon I will be able to continue to put features together.

coolestdude1’s picture

Assigned: Unassigned » coolestdude1
Status: Needs work » Closed (fixed)

Just submitted the fix into the repo thanks.

organicHack’s picture

Thanks guys,

From altrugon's comment, I was able to create a directory "theme/templates/dynamic_banner" then put "banner_output.tpl.php" inside it. worked like a charm. I like to keep all my template files in subdirectories (node, page, field, view, etc) for organizational reasons.

Very very useful module!