开发者

How to theme Lightbox

I need to theme my lightbox. I can see the HTML generated by the JavaScript code in lightbox.js, but I cannot overwrite that file, or I will lose my changes when I update the module. Is there 开发者_Python百科any better way to override a theme output?


You didn't report for which Drupal version you are interested; the answer I am giving is valid for Drupal 6, but few things would change for Drupal 7.

Lightbox2 uses a template file for its output. If you create a custom module that implements hook_theme_registry_alter() to use a different template file, then you can use a template file that uses a JavaScript file you wrote.


can you not theme it just by changing the CSS?

In your theme's .info file you can override the module's css and/or js and then you copy the css or js file from the module into your own theme folder, (every theme should have a .info, if not create one) - this means you don't touch the actual contrib modules files

Drupal will then use the one from your theme, which you can edit to your hearts content, and if you do hit problems you just remove the entry from the .info file and it will then go back to using the original module filea.

I haven't done it for JS but I believe the process is the same as for CSS and here is a snippet of what's in my .info file - btw I think once you use this method of overriding you have to declare the default style.css too

stylesheets[all][] = style.css
stylesheets[all][] = lightbox.css

Update:

It's only possible to use the .info file to override JS in D7, but there is module JSAlter which might help with D6

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜