SlideShare a Scribd company logo
On Cabling On Line - www.col.net.au Theming of Table Views Using: Overriding theme functions   Signwriter Module   jTooltips Module   Custom Module By Geoff Davies (gpdinoz) from Behind the Page
Cabling On Line is a Directory of links for the Australian and New Zealand Cabling Industry. People can register and submit information about their products and services with links to their own site for more information. If they want more listings there are 4 levels of paid  sponsorship available. Each type of product or service is listed using a table view with it's filter on a separate page so listing can be searched for relevant entries. Some Drupal Specs 11 Types of users with 5 sponsorship levels => 62 roles 31 Custom Node Types (using CCK)‏ 35 Views It is a work in progress with a custom theme still to come and a lot more explanatory text needed. Introduction
 
 
46 columns wide table  Table Headings running vertical Dots in table with hover tooltips  Filter on separate page Features
Filter on Separate page
Standard Drupal theming
With Custom theming
Overriding theme functions theme_views_view_table (Standard Drupal theming for views tables)  phptemplate_views_view_table (Overrides all view table theming)  phptemplate_views_view_table_Contractors (Overrides only Contractors view table theming)  (Place in template.php)
theme_views_view_table function theme_views_view_table($view, $nodes, $type) { $fields = _views_get_fields(); foreach ($nodes as $node) { $row = array(); foreach ($view->field as $field) { if ($fields[$field['id']]['visible'] !== FALSE) { $cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields,  $field, $node, $view); $cell['class'] = "view-field ". views_css_safe('view-field-'. $field['queryname']); $row[] = $cell; } } $rows[] = $row; } return theme('table', $view->table_header, $rows); }
Overiding the function in template.php function phptemplate_views_view_table_Contractors($view, $nodes, $type) { $fields = _views_get_fields(); foreach ($nodes as $node) { $row = array(); foreach ($view->field as $field) { if ($fields[$field['id']]['visible'] !== FALSE) { switch ($field['field']) { case 'title'; case 'field_contractor_sponsership_value'; case 'field_contractor_website_url'; case 'field_contractor_postcode_value'; $cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view); $cell['class'] = "view-field ". views_css_safe('view-field-'. $field['queryname']); $row[] = $cell; break; default :...... cont
Display dots in cell if '1' in database default: $number = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view); if ($number ==1) { $number ='<img src=&quot;/media/headings/dot.png&quot; alt=&quot;Y&quot;  title=&quot;'.$field['label'].'&quot; >'; } else { $number =''; } $cell['data'] = $number; $cell['class'] = &quot;view-field &quot;. views_css_safe('view-field-'. $field['queryname']); $row[] = $cell; } } } $rows[] = $row; } . . . . . . . . . .continued, but first introducing the signwriter module
Signwriter Module The Signwriter module allows you to use custom fonts in headings. It does this by replacing html headings with an image generated from a TrueType font file which resides on the server.  It can also be embedded in your theme with the following code $profile = signwriter_load_profile('Theme Heading'); print signwriter_title_convert($title, $profile); I modified the signwriter module to write vertically. A few examples:
 
 
Replacing headers with images using Signwriter module $profile = signwriter_load_profile('ViewHeaders'); $profile->height = 220 ; foreach($view->table_header as $key=>$value){ if ( $key != 1 AND $key != 3){ $text = $view->table_header[$key]['data']; $view->table_header[$key]['data'] = signwriter_title_convert($text, $profile); } } return theme('table', $view->table_header, $rows, $attributes = array('id'=>'Contractors_view')); }
Custom Module Overview This module hides the filter on specific views and creates a separate page where it is displayed as checkboxes and in 4 columns hook_form_alter to hide the filter on the view hook_menu to create paths for each separate “search” page custom function that loads the correct filter and formats it as checkboxes and display them in 4 columns
The End

More Related Content

PDF
Field formatters
PPT
Drupal Form Api
ODP
HTML::FormHandler
PDF
Михаил Крайнюк. Form api: ajax-commands
PPT
Plone For Developers - World Plone Day, 2009
PDF
Make your own wp cli command in 10min
PDF
Shortcodes In-Depth
PDF
Advanced Custom Fields - Flexible Content
Field formatters
Drupal Form Api
HTML::FormHandler
Михаил Крайнюк. Form api: ajax-commands
Plone For Developers - World Plone Day, 2009
Make your own wp cli command in 10min
Shortcodes In-Depth
Advanced Custom Fields - Flexible Content

What's hot (18)

PDF
PPTX
11. CodeIgniter vederea unei singure inregistrari
PPT
Drupal Lightning FAPI Jumpstart
PPT
Oop php 5
PPSX
SenchaCon 2016: Developing COSMOS Using Sencha Ext JS 5 - Shenglin Xu
PDF
Apostrophe
PPTX
Think Generic - Add API's To Your Custom Modules
PDF
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
PPT
Framework
ZIP
Learning the basics of the Drupal API
PPT
Zend framework 04 - forms
PPTX
Автотесты для картинок
PDF
Rapid Prototyping with PEAR
PPTX
Smarty
PDF
Image manipulation in WordPress 3.5
PPTX
Learn java script
PDF
Андрей Юртаев - Improve theming with (Twitter) Bootstrap
KEY
Geek Moot '09 -- Smarty 101
11. CodeIgniter vederea unei singure inregistrari
Drupal Lightning FAPI Jumpstart
Oop php 5
SenchaCon 2016: Developing COSMOS Using Sencha Ext JS 5 - Shenglin Xu
Apostrophe
Think Generic - Add API's To Your Custom Modules
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Framework
Learning the basics of the Drupal API
Zend framework 04 - forms
Автотесты для картинок
Rapid Prototyping with PEAR
Smarty
Image manipulation in WordPress 3.5
Learn java script
Андрей Юртаев - Improve theming with (Twitter) Bootstrap
Geek Moot '09 -- Smarty 101
Ad

Viewers also liked (6)

KEY
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
PPT
Using Twitter - Bold & the Blogging - David Alston - Radian6
PDF
Creating Drupal 7 subtheme
PDF
Drupal Essentials: Comment Management in Drupal 7
PPTX
A look at Drupal 7 Theming
PDF
Drupal 7 Theme System
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Using Twitter - Bold & the Blogging - David Alston - Radian6
Creating Drupal 7 subtheme
Drupal Essentials: Comment Management in Drupal 7
A look at Drupal 7 Theming
Drupal 7 Theme System
Ad

More from Ryan Cross (20)

PDF
Introduction to Content Marketing Strategy for Drupal
PDF
DrupalCon Wrap Up
PPTX
Sydney Drupal News Feburary 2013
PPTX
Drupal news 2012 October
PPTX
Sydney Drupal News June 2012
PPTX
Sydney Drupal News April 2012
PPTX
Sydney Drupal News August 2012
PPTX
Sydney Drupal News July 2012
PPTX
Sydney Drupal News February 2012
PPTX
Sydney Drupal News May 2012
PPTX
Sydney Drupal News September 2012
PPTX
Sydney Drupal News March 2012
PDF
Lightning Talk: Drupal Feeds
PPTX
Sydney Drupal News February 2012
PPTX
Sydney Drupal News March 2012
PPT
Drupal's Roadmap: The Magic 8 Ball
PPT
Converting Static Html To Drupal Theme
PDF
Panels 2 Demo
PDF
Modify a Theme
ODP
Drupal Basics
Introduction to Content Marketing Strategy for Drupal
DrupalCon Wrap Up
Sydney Drupal News Feburary 2013
Drupal news 2012 October
Sydney Drupal News June 2012
Sydney Drupal News April 2012
Sydney Drupal News August 2012
Sydney Drupal News July 2012
Sydney Drupal News February 2012
Sydney Drupal News May 2012
Sydney Drupal News September 2012
Sydney Drupal News March 2012
Lightning Talk: Drupal Feeds
Sydney Drupal News February 2012
Sydney Drupal News March 2012
Drupal's Roadmap: The Magic 8 Ball
Converting Static Html To Drupal Theme
Panels 2 Demo
Modify a Theme
Drupal Basics

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Electronic commerce courselecture one. Pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
A comparative analysis of optical character recognition models for extracting...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectral efficient network and resource selection model in 5G networks
Programs and apps: productivity, graphics, security and other tools
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Electronic commerce courselecture one. Pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Approach and Philosophy of On baking technology
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
gpt5_lecture_notes_comprehensive_20250812015547.pdf
MYSQL Presentation for SQL database connectivity
Mobile App Security Testing_ A Comprehensive Guide.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Spectroscopy.pptx food analysis technology
Encapsulation_ Review paper, used for researhc scholars
A comparative analysis of optical character recognition models for extracting...

Advanced Drupal Views: Theming your View

  • 1. On Cabling On Line - www.col.net.au Theming of Table Views Using: Overriding theme functions Signwriter Module jTooltips Module Custom Module By Geoff Davies (gpdinoz) from Behind the Page
  • 2. Cabling On Line is a Directory of links for the Australian and New Zealand Cabling Industry. People can register and submit information about their products and services with links to their own site for more information. If they want more listings there are 4 levels of paid sponsorship available. Each type of product or service is listed using a table view with it's filter on a separate page so listing can be searched for relevant entries. Some Drupal Specs 11 Types of users with 5 sponsorship levels => 62 roles 31 Custom Node Types (using CCK)‏ 35 Views It is a work in progress with a custom theme still to come and a lot more explanatory text needed. Introduction
  • 3.  
  • 4.  
  • 5. 46 columns wide table Table Headings running vertical Dots in table with hover tooltips Filter on separate page Features
  • 9. Overriding theme functions theme_views_view_table (Standard Drupal theming for views tables) phptemplate_views_view_table (Overrides all view table theming) phptemplate_views_view_table_Contractors (Overrides only Contractors view table theming) (Place in template.php)
  • 10. theme_views_view_table function theme_views_view_table($view, $nodes, $type) { $fields = _views_get_fields(); foreach ($nodes as $node) { $row = array(); foreach ($view->field as $field) { if ($fields[$field['id']]['visible'] !== FALSE) { $cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view); $cell['class'] = &quot;view-field &quot;. views_css_safe('view-field-'. $field['queryname']); $row[] = $cell; } } $rows[] = $row; } return theme('table', $view->table_header, $rows); }
  • 11. Overiding the function in template.php function phptemplate_views_view_table_Contractors($view, $nodes, $type) { $fields = _views_get_fields(); foreach ($nodes as $node) { $row = array(); foreach ($view->field as $field) { if ($fields[$field['id']]['visible'] !== FALSE) { switch ($field['field']) { case 'title'; case 'field_contractor_sponsership_value'; case 'field_contractor_website_url'; case 'field_contractor_postcode_value'; $cell['data'] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view); $cell['class'] = &quot;view-field &quot;. views_css_safe('view-field-'. $field['queryname']); $row[] = $cell; break; default :...... cont
  • 12. Display dots in cell if '1' in database default: $number = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view); if ($number ==1) { $number ='<img src=&quot;/media/headings/dot.png&quot; alt=&quot;Y&quot; title=&quot;'.$field['label'].'&quot; >'; } else { $number =''; } $cell['data'] = $number; $cell['class'] = &quot;view-field &quot;. views_css_safe('view-field-'. $field['queryname']); $row[] = $cell; } } } $rows[] = $row; } . . . . . . . . . .continued, but first introducing the signwriter module
  • 13. Signwriter Module The Signwriter module allows you to use custom fonts in headings. It does this by replacing html headings with an image generated from a TrueType font file which resides on the server. It can also be embedded in your theme with the following code $profile = signwriter_load_profile('Theme Heading'); print signwriter_title_convert($title, $profile); I modified the signwriter module to write vertically. A few examples:
  • 14.  
  • 15.  
  • 16. Replacing headers with images using Signwriter module $profile = signwriter_load_profile('ViewHeaders'); $profile->height = 220 ; foreach($view->table_header as $key=>$value){ if ( $key != 1 AND $key != 3){ $text = $view->table_header[$key]['data']; $view->table_header[$key]['data'] = signwriter_title_convert($text, $profile); } } return theme('table', $view->table_header, $rows, $attributes = array('id'=>'Contractors_view')); }
  • 17. Custom Module Overview This module hides the filter on specific views and creates a separate page where it is displayed as checkboxes and in 4 columns hook_form_alter to hide the filter on the view hook_menu to create paths for each separate “search” page custom function that loads the correct filter and formats it as checkboxes and display them in 4 columns