Drupal Theming

Image link rollovers for dynamic (user-uploaded) graphics with Drupal and CSS

Key words and phrases: 
rollover with dynamic graphics jquery rollover drupal User-uploaded images for rollover links "css rollover without background" drupal add css from a theme Drupal user-uploaded graphics for rollover user-provided rollover graphics rollover link for Drupal uploaded image files
Description & Info: 

Eliminating other options:

This could be done with JavaScript, but we and the W3C and everyone's sanity would much prefer a pure CSS solution.

Can you have inline styles with pseudo classes (namely, :hover?)

No: http://www.frontpagewebmaster.com/m-351101/tm.htm

From http://www.christianmontoya.com/2006/02/01/pure-css-image-rollover/

by Benjamin Melançon
Posted on Mon, 2008-09-01 10:31
in

Add a span wrapper inside primary and secondary menu links in Drupal 6

Key words and phrases: 
span wrapper for primary links make tab-style links for main navigation menu
Description & Info: 

This document takes us through the steps of figuring out how some output is produced (without an Integrated Development Environment with debugger) so that we can modify it. Skip straight to Agaric's answer in the resolution at the bottom if that's all you want!

All I want to do is throw spans around the links. Ah well. Here is the function below, modified to do exactly that.

It will do it to all sets of links passed through theme('links', $links) but so far on Agaric's example site, at least, that means only the primary links.

<?php
function examplezen_links($links, $attributes = array('class' => 'links')) {

by Benjamin Melançon
Posted on Fri, 2008-08-29 08:48
in

Building a Zen sub-theme: In shell commands

Key words and phrases: 
bash shell terminal command line make a Zen subtheme sub Zen theme for Drupal via command line
Description & Info: 

From the Zen documentation How to build your own sub-theme (6.x), translated into bash commands. The project is called example, and we have installed the zen theme to sites/default/themes.

Someone enterprising could make this into a simple bash script.


cd /sites/example/www/sites/default/themes
sudo cp -pr zen/STARTERKIT/ example_zen

by Benjamin Melançon
Posted on Thu, 2008-08-28 18:39
in

Internet Explorer 6 appears to have PNG problems beyond its well-known transparency issues

Key words and phrases: 
IE6, PNG
Description & Info: 

IE6 has extremely weird PNG issues

Microsoft owes me another 4 hours of my life.

Just to let you know, apparently PNGs (without transparency, nothing to do with transparency on the page anywhere I was aware of, though there was a video and lots of other stuff), can simply fail to show up in the image tag. A completely normal img src style tag just doesn't display.

by Benjamin Melançon
Posted on Thu, 2008-08-28 11:18
in

Panels2 and Organic Groups

Key words and phrases: 
panels2 panels 2 drupal organic groups og OG config configuration setup set up how to configure module
Description & Info: 

So you want to use drupal's Organic Groups module and Panels2 because you've heard through the grapevine that really slick and useful things can be done with the combo..

Well, here's what one of the experts has to say about it --> http://www.tejasa.com/node/160

highly recommended and very useful...

do it!

Where in the theme are the tabs printed / giving tabs to admins only

Key words and phrases: 
Drupal tabs local tasks where printed by theme? phptemplate_variables page phptemplate node page tabs give tabs to admins only
Description & Info: 

On giving View, Edit, Revision, etc. tabs to administrators only.

In Drupal, tabs are not printed by the node, but by the page. On the one hand, since views and administrative pages and anything else you can think of can have tabs, this makes sense. But on the other hand every node can have

by Benjamin Melançon
Posted on Thu, 2008-08-14 06:06
in

Drupal theming tip: theme_ functions you should NOT override

Key words and phrases: 
theme override don't menu item listing do not do it that way menu_list theme_list_item theme_menu_list theme_item_list
Description & Info: 

Theme functions are designed so that they can be overridden, but the building block theme functions provided by Drupal core should be left alone.

In discussion with a colleague, who provided all the insight paraphrased below, talking about some of the Drupal gotcha's we've seen get talented people not sufficiently indoctrinated into the Drupal way.

Sidebar graphics with links ("promotional badges") the Agaric Drupal way

Key words and phrases: 
show graphics in sidebar on certain pages linked to featured sections easily change graphics in specific sidebar block regions
Description & Info: 

A note of warning about the length of notes to follow: This is site configuration at the point where it verges on developer documentation, such is the power of Drupal, and there's some outright theming in here too. This article is a reaction to doing sidebar graphics the painfully non-Drupal way.

Theming CCK Views the Agaric Way (with background)

Key words and phrases: 
theme views CCK imagefield with imagecache
Description & Info: 

Note that Views and CCK's imagefield module have excellent imagecache integration and you only need these steps if you want very fine-grained control-- in our case, automatically populating the ALT text of the image with the node title.

/admin/build/views/wizard

and

http://agaricdesign.com/note/how-theme-lots-views-agaric-way

and then a little

<?php
print '

';

If you think like we do you'll have something like this in template.php:

<?php
/**
* Theme views invoked by view-specific callbacks (see below).
*/
function phptemplate_views_template($template, &$view, &$nodes, &$type) {
$fields = _views_get_fields();
$taken = array();

// Set up the fields in nicely named chunks.
foreach ($view->field as $id => $field) {

by Benjamin Melançon
Posted on Sun, 2008-08-03 10:40
in

Different page templates for different content types

Key words and phrases: 
Different page templates for different content types page.tpl for content type drupal 5 5.x theming
Description & Info: 

Once upon a time there was a drupal themer working on a dark and stormy night, he sat there wondering how to make different page templates for certain content types on his site. He thought about how the drupal template system seems to be missing this for some reason... Suddenly, he had a vision! Like a ray of light bringing, hope and happiness down from the heavens!! oh yes!!

<?php
// Add additional template suggestions
function _phptemplate_variables($hook, $vars) {
  switch (
$hook) {
    case
'page':  
     
// Add page template suggestions based on node type, if we aren't editing the node.
     
if ($vars['node'] && arg(2) != 'edit') {
       
$vars['template_files'][] = 'page-'. $vars['node']->type;
      }
      break;
  }
  return
$vars;
}
?>

by Dan
Posted on Fri, 2008-07-25 15:48
in