I would appreciate some guidance on how to add a banner display from the banner module to the XTemplate theme.

Thanks!

Radi

Comments

dries’s picture

The banner module is relatively new: there is not much banner module expertise yet. You'll have add an extra field to the first $xtemplate->template->assign() statement in the xtemplate_header() function of themes/xtemplate/xtemplate.theme:

...
"banner" => banner_display(0),
...

This will create a new variable, {banner}, that you can use in the header part of themes/xtemplate/xtemplate.xtmpl.

usharf’s picture

Where is the xtemplate_header() in drupal 4.4? Working with the CVS versioמ, it seem it has been removed?

And I would appriciate a more detailed example of how to enable the banner in this version as well. I've got every thing working but I can't embed the banner_display(0) in a block nor in the theme/xtmpl files.

dries’s picture

As of Drupal 4.4.0, the functions xtemplate_header() and xtemplate_footer() have been merged into xtemplate_page(). Thus, you should modify xtemplate_page() instead.

If the banner documentation is not sufficiently explanatory, please file a task describing what you'd like to see documented. Jeremy, the author and maintainer of the banner module, has always been quite repsonsive.

usharf’s picture

Yes, I realized that after playing with this stuff. On the positive side, when you start doing so it realy helps you understand how drupal is working, which is cool :)

What I've done so far was:

1. Adding to xtemplate.theme under xtemplate_page()

"banner" => variable_get(banner_display(0))

2. Adding to xtemplate.xtmpl the following:

roobul’s picture

Where exactly did you put {banner} in xtemplate.xtmpl?
Trying to get this to go in 4.3 -- God, what a struggle!

gatezone’s picture

"God, what a struggle!" I couldn't agree more. The dummie in the subject is me.

I'm working with 4.5 and the above instructions seem to be further out of date...?

I struggle with themes with each and every update. I'd suggest including a fully patched xtemplate.xtmpl file with the banner module. Patches are IMO inherently problematic for a high percentage of site creators and admins. Because banner areas (not just for ads...) are so common in themed headers it would be wonderful to have a 'header' banner tool like the great new logo upload tool which doesn't eliminate tweaking the header, but at least it makes the process easier. GZ

jeremy’s picture

Please refer to this INSTALL file for 4.5 installation instructions.

Please refer to this included patch file to see how to patch the xtemplate theme.

dspearing’s picture

... no go, I haven't been able to get this to work.

I also picked appart the patch file and modified an original copy from the archive of the three files and I still don't see the banners.

I am running 4.5.2 with little to no modification yet aside from this module. I've installed the easy ones (those that don't require modding the app) this is my first attempt and a slightly more involved module.

Thanks in advance for any help!

jeremy’s picture

If you're having troubles installing the banner module, please open a support request.

kbahey’s picture

If you are just looking for already patched theme files, check my post here http://drupal.org/node/15860 for where to get them from.

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

dspearing’s picture

I ended up opening a support case. I tried the already patched files as well and they didn't show the banners either. It's really strange, I even took out phptemplate which I had installed and no go there.

fjordans’s picture

Just thought it might be useful for people to know that you can define a specific banner group for the banners that should appear in your header (pushbutton theme) by editing the /themes/engines/xtemplate/xtemplate.engine file. Find the line

$xtemplate->template->assign('banner', banner_display());

and put the banner group number between the brackets after 'display'. If you want to change the group at a later date you will have to do so manually in this file.

noid’s picture

Hi fjordans,

Can't find that line. Am using 4.6.

alexandreracine’s picture

    <?php if (module_exist('banner')) : ?>
     <div id="banner"><?php print banner_display() ?></div>
    <?php endif; ?>

Put it in your theme or even better, put it in a flexiblock! You will have more control where it will show. For example for the front page only. This is for 4.6.3 with phptemplate by the way.

noid’s picture

Thanks for the tip, alex. Can you help me out with configuring flexiblock -- http://drupal.org/node/33765 . Thanks again! :)

alexandreracine’s picture

Just follow the docs in the flexiblock :)
I added an article in there http://drupal.org/node/33765