Convert ad display functions to template files (.tpl.php) for easier theming / enable preprocess functions.

The only problem with template files is that they are slower than functions for creating content. I have left the old function in place in case anyone needs to revert because of performance issues. To change between the template and the function, the file / template lines in the ad_display array in function ad_theme in ad.module need to be commented / uncommented.

This attachment covers the ad_display function in ad.module (general formats for the ad block, not for individual ads). I will post further patches / files for html ads and image ads.

Comments

SweeneyTodd’s picture

StatusFileSize
new817 bytes

I have now created the template file and patch for the text ad.

I have created a single template file (ad-text-ad.tpl.php) to replace the previous messy system with 2 theme functions (ad_text_ad and ad_text_text).

As before, the old code has been left in place; to change between the template and the functions, the file / template lines in the ad_text_ad array in function ad_text_theme in ad_text.module need to be commented / uncommented.

These changes can be implemented independent of (or in addition to) the changes to theming the ad block contents (see original post).

SweeneyTodd’s picture

StatusFileSize
new1.27 KB

I have created the template and patch for the image ad.

Again I have created a single template from the 2 theme functions. A lot of the php for the image is done in the preprocess function in ad_image.module so the function file looks pretty bare.

Implementation of this does not depend on any of the above patch / templates so these can be tried out individually.

SweeneyTodd’s picture

StatusFileSize
new673 bytes

...and finally I have done the html ad.

I do not intend doing the external ad type as well unless anyone really wants it - let me know.

lrwebks’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Drupal 6 is EOL and no longer supported. Closing this as outdated for that reason. Thanks for your contribution!