User login

Drupal Theming

Remove "Add comment" links from teasers

See and report to:

How to disable "Add new comment" at teaser part, but "Read more" remains
http://drupal.org/node/151648

Hi Brian,

So the Drupal user interface wasn't enough? You had to make a custom node template? It took us a few months to notice the new options for displaying fields, but now we use it a lot instead of node-TYPE.tpl.php files. And I'd be interested what in that post needed updating for Drupal 6!

Be sure to register templates moved to module layer, and moving functions from template.php to module

Using FileMerge to compare (Mac OS X graphical diff), no differences between the page.tpl.php in the scf_base theme and the page.tpl.php I have in scf.module.

But the site doesn't look the same at all. That means the reason moving template files to the theme layer failed is because I am not calling them right.

Had to put them in hook_theme_registry, of course.

Once that was done, progress began in earnest. Breaking the site, of course.

Print information associated with a node elsewhere in page.tpl.php, using a separate template file for theming

Thanks to a little refresher on the _phptemplate_callback function (replaced in Drupal 6's theming system with the theme registry) from searching Nick Lewis' site.

Theming Organic Groups

Want to have more control over what your new organic groups look like? I can't imagine why else you'd be reading this...

Resolution

try this out:

Copy node-og.tpl.php to your theme's directory you'll need to rename it to reflect your group's node type(s). If your group node type is "partner" then you'd rename node-og.tpl.php to node-partner.tpl.php.

http://drupal.org/node/287298

Menus (and other theme options) disappear after directly editing the theme settings variable

After directly replacing just the icon location (changing sites/example to sites/default and nothing else) in the theme settings (global and theme-specific) of a site recently updated from Drupal 5 to Drupal 6, the menu for the site disappeared with array_merge errors in two lines in the ./includes/theme.inc file.

Going to the global theme settings and resaving the variables (which were all missing, no checkboxes marked) fixed the problem.

Strange. But true!

Resolution

Use hook_theme for new theming functions and templates; use hook_theme_registry_alter to take over existing ones

Everyone else has figured this out by now, but loudly proclaiming ignorance (as soon as I know I am ignorant) is a proud U.S. of A. tradition (albeit ordinarily done with less self-awareness).

Apologies if you had to click to read this, because the whole insight is in the page title: Use hook_theme for new theming functions and templates; use hook_theme_registry_alter to take over existing ones.

Agaric will demonstrate this with a negative example and a positive example.

How to reset the theme registry

Update for D7:

drupal_flush_all_caches();

drupal_flush_all_caches() should work for just about anything. registry_rebuild() alone did not work in my tests.

Drupal 6

The Drupal function to reset the theme registry is drupal_rebuild_theme_registry (D6).

You can add it to your template.php while developing:

Not dead yet: Overcoming fatal errors converting a theme with some override functions in template.php

Upgrading a theme from Drupal 5 to Drupal 6, Agaric ran across this lovely fatal error:

Fatal error: Call to undefined function menu_item_link() in /sites/example/www/sites/default/themes/agaric_custom_theme/template.php on line 15

And indeed, menu_item_link ends with Drupal 5: http://api.drupal.org/api/function/menu_item_link/5

Site layout destroyed by weird invisible character in stylesheet

what just happened? some scary bad invisible character(s) got in the css file

I think by using Digital Color Meter

And caused all the CSS rules after that character not to work!

Resolution

Syndicate content