User login

Theme a Views Table

Very useful thread, great helpful people responding to it:

How to theme view module's "table view"?
http://drupal.org/node/87367

Thanks to a tip from

<?php
/**
 * Function to handle a sample field.
 */
function phptemplate_views_handle_field_participants_users_name($fields, $field, $data) {
  $info = $fields[$field['fullname']];

  if ($field['handler'] && function_exists($field['handler'])) {
    return $field['handler']($info, $field, $data->$field['queryname'], $data);
  }

  if ($info['handler'] && is_string($info['handler']) && function_exists($info['handler'])) {
    return $info['handler']($info, $field, $data->$field['queryname'], $data);
  }

  return check_plain($data->$field['queryname']);
}
?>

Fields can be precisely overrided with functions named like this (and modeled on the above), where "participants" is the name of the view:

Node: Author Name

phptemplate_views_handle_field_participants_users_name

Taxonomy: Terms for Places (vocabulary number 5)

phptemplate_views_handle_field_participants_term_node_5_name

Node: Body

phptemplate_views_handle_field_participants_node_body

@TODO ben-agaric: Get a CCK field example.

Resolution

Searched words: 
theme a table view drupal Drupal theme individual view field

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.