Table functions - from array to HTML table
Some functions useful when generating HTML tables from an array. Note that themeTabel() is standalone, but themeTable2() requires to supporting functions themeAttributes() and themeTableCell().
Some functions useful when generating HTML tables from an array. Note that themeTabel() is standalone, but themeTable2() requires to supporting functions themeAttributes() and themeTableCell().
This is how you get theme template name suggestions from your theme template.php file
This is how you can override Drupal 6 theme table using odd/even and let theme('table'...) group table rows by an ID (in this case by 'nid') and apply odd and even on the groups.
How to convert or theme file size in bytes to a better readable form of kilobytes, megabytes or gigabytes etc, based on the factor of 1024.
In some themes you have to style the dropdownbox and it can be hard to catch it in Firebug.
The Drupal 6 theme_table function is missing the ability to use tfoot tag for totals etc. This become hard when you add a jQuery table sorter and the totals start jumping around with the other rows. I made my own table function to get around this problem in Drupal 6. AS for now not even Druapl 7 have this feature.
If your theme has a template engine you can override a theme function in both your module and in your theme template.php
To override the function call theme('item_list') you have to copy the original function named theme_item_list and add it to your module or template.php replace theme_ with phptemplate_ and make your changes to the code.
This is how you can add colorpicker to a form textfield for instance in your theme settings file.
drupal_add_css('misc/farbtastic/farbtastic.css');
drupal_add_js('misc/farbtastic/farbtastic.js');
$form['color'] = array(
'#type' => 'textfield',
'#title' => t('Color pickmeup'),
'#default_value' => '#123456',
'#description' => '
',
);
$form['colorpicker_example'] = array(
'#type' => 'item',
'#description' => "
This is how you can get all defined variables in a template file like node.tpl.php in your theme folder by using get_defined_vars().
This is how you can change theme on a single view programmatically based on path. In my case I have made some own modules and I want those views using the current admin theme instead of the default theme. I let the path decide what theme to use in hook_init. I also thought it all user views should have the admin theme.