What you don’t know you don’t know about Drupal 6 Dan Harris daneesia on drupal.org.

Slides:



Advertisements
Similar presentations
Bending Zen Intro Using Zen Themes functionality, but bending it into your own theme.
Advertisements

Microsoft ® Office Excel ® 2007 Training Get started with PivotTable ® reports Sweetwater ISD presents:
Microsoft ® Office Outlook ® 2007 Training Manage your mailbox IV: Archive old messages P J Human Resources Pte Ltd presents:
Become a Panels Rockstar. Audience Survey Have you tried Panels? Are you a …. –Themer / Designer? –Developer / Code Junkie? –Information Architect?
DOMINATE THE THEME LAYER August 21st.. Jesper Wøldiche Rahkonen Themer / architect at Bysted. Markup Marine / Journalist / Frontend United
July 2010 D2.1 Upgrading strategy Javier Soto Catalog Release 3. Communities.
 Copyright I/O International, 2013 Visit us at: A Feature Within from Vendor Payment Terms User Friendly Maintenance 
Student Manager Catalog Builder An ACEware Webinar.
Customizing your Theme Information Systems 337 Prof. Harry Plantinga.
Newsletter Plugin The newsletter plugin allows you to create and send newsletters to a managed list or multiple lists of users. Your users can subscribe.
High Performance Faceted Interfaces Using S2S Eric Rozell, Tetherless World Constellation.
Slide 1 FastFacts Feature Presentation 12/16/2014 To dial in, use this phone number and participant code… Phone number: Participant code:
Google Confidential and Proprietary 1 Intro to Docs Google Apps Apps.
8/16/2015alicewebmaster1 Create contents with the new Content Management System (Drupal): Workflow for page editors.
The Dr ü G Book: An Intro to Drupal The Dr ü G Book: An Intro to Drupal (Dr ü G: Drupal User ’ s Group - users, not developers) This is an introduction.
® IBM Software Group © 2006 IBM Corporation JSF Tab Controls This Learning Module shows how to develop server-side EGL applications with dynamic content.
Drupal 7 as an enterprise web application framework Why as a developer you should use Drupal to build web applications? Klaus Harris DrupalCon Munich 2012.
RefWorks: Advanced February 13, What We’ll Cover Today Managing Your Personal Database Searching Your Personal Database Linking to the Full Text.
Installing CiviCRM onto Wordpress. How does it work?
TOP 20 MISTAKES YOU WILL MAKE IN YOUR 1ST DRUPAL PROJECT IZTOK SMOLIČ, ZAGREB.
1/30/11 Hacking your way through the Drupal API, a themers intro Baris Wanschers (BarisW)
Drupal Training Syllabus Chaitanya Lakshmi
CTRL + Z is your best friend. Use it to undo anything! You can even undo multiple mistakes!
Welcome to IT133 Software Applications Unit 8 aka Prof Brooke.
Moodle (Course Management Systems). Assignments 1 Assignments are a refreshingly simple method for collecting student work. They are a simple and flexible.
THE BIG PICTURE. How does JavaScript interact with the browser?
Mail merge I: Use mail merge for mass mailings Perform a complete mail merge Now you’ll walk through the process of performing a mail merge by using the.
Drupal Jumpstart Information Systems 337 Prof. Harry Plantinga.
Chapter 6 Generating Form Letters, Mailing Labels, and a Directory
Teacher’s Assessment Assistant Worksheet Builder Starting the Program
Lecture 8 – Cookies & Sessions SFDV3011 – Advanced Web Development 1.
Go to your school’s web locker site school name.schoolweblockers.com) Your user name is the first letter of your first name, the first 4.
Drupal Themes The Survival Guide Drupal Camp | Managua 2009.
Drupal Overview Prepared by : Agustin D. Gumogda Jr. Instructor.
Forensic Drupal Debugging Dan Harris daneesia on drupal.org.
Surveys UAS IT Helpdesk Creating and Posting By, Michaela – Student Assistant.
To access our web services, go to……. Click on Customer Login.
Exercise Your your Library ® RefWorks: Advanced November 21, 2006.
Microsoft ® Office Excel 2003 Training Using XML in Excel SynAppSys Educational Services presents:
UoS Libraries 2011 EndNote X5 - basic graduate session.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 8: Working with Style Sheets.
Drupal Theming Chris Neglia and Lisa Forgan Copyright 2009, Page 1 Solutions.
KW Advanced Agent Website Training April, What We will Discuss Using hyperlinks to your “contact me/us page” Which color boxes control what areas.
SharePoint 2010 Key Parts to Navigation Shared Document Library Add/Remove item from Quick Launch Using the Search Choose a Topic.
Word Create a basic TOC. Course contents Overview: table of contents basics Lesson 1: About tables of contents Lesson 2: Format your table of contents.
31/01/ Selection If selection construct.
WaveMaker Visual AJAX Studio 4.0 Training Java Script Events.
PHP (cont.). 2 Functions Definition – function name(arguments){... } –syntax name as for a variable, but without $ arguments as for variables –to return.
Working with the interface and interacting with the iPad app.
CSS IS A LANGUAGE DESIGNED TO TARGET HTML ELEMENTS AND NODES BY TYPE, CLASS, ID AND VALUE, AND CHANGE THEIR VALUES CSS – change how your HTML looks and.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
Developer Exam Preparation Thom Robbins Bryan Soltis
Wes Preston DEV 202. Audience: Info Workers, Dev A deeper dive into use-cases where client-side rendering (CSR) and SharePoint’s JS Link property can.
Nuts and Bolts of Your LawHelp Site February 2014.
A first stab at a better templating system for Chisimba The Chisimba Canvas.
Panels 3 Deborah Fuzetto. Panels Allows you to create customized layouts Drag & Drop content into Panes.
Perform a complete mail merge Lesson 14 By the end of this lesson you will be able to complete the following: Use the Mail Merge Wizard to perform a basic.
Ecampus Training Session Trainer: Siddhesh Krishnan.
Creating a Theme From Scratch in Drupal
Note to trainers The videos in this presentation provide closed-caption files, and they’re on by default because it’s often easier for viewers of all.
Weebly Elements, Continued
RefWorks: Advanced November 23, 2005.
Customizing your Theme
NoodleBib Helps you use your “noodle”!
More Selections BIS1523 – Lecture 9.
Keeping it Current with RSS
INTRODUCTION TO THE GRANT CENTER
Input and Output Python3 Beginner #3.
3rd Party Widgets & Custom Code
Presentation transcript:

What you don’t know you don’t know about Drupal 6 Dan Harris daneesia on drupal.org

Drupal is Truly Amazing Because You can hook into virtually any part of the execution Because You can hook into virtually any part of the execution Because the theming is so elegantly layered Because the theming is so elegantly layeredBUT… Much of its amazement is un- or under- documented Much of its amazement is un- or under- documented Too often the docs that do exist live buried in some thread on drupal.org/node/NNNNN Too often the docs that do exist live buried in some thread on drupal.org/node/NNNNN

This Session is for you if… You've ever wondered "Where the #$%!^ does THAT HTML come from" (and how to override it)? You've ever wondered "Where the #$%!^ does THAT HTML come from" (and how to override it)? You've ever wondered if there are more.tpl.php files than what Views claims to be available after clicking the Theme: Information link You've ever wondered if there are more.tpl.php files than what Views claims to be available after clicking the Theme: Information link You're curious how to build a view using the Views API You're curious how to build a view using the Views API You're curious how to display CCK fields You're curious how to display CCK fields –in regions other than the primary content area –directly from a.tpl.php file –while empowering your content editors to edit entire pages in one place without using Panels or other modules.

Agenda Methods for discovering Methods for discovering –where that HTML is coming from –how Themer may be helpful –how to find what you’re looking for without Themer What sorts of files and functions are What sorts of files and functions are –begging to be overridden –where they may be hiding Some Useful Views API functions/CCK variables Some Useful Views API functions/CCK variables Q&A Session Q&A Session

Where the #$%^&! is that HTML Coming From??? Motivation: I typically find it harder to debug CSS than get the output I want Motivation: I typically find it harder to debug CSS than get the output I want Example: Example: ……… Where does the red markup come from? Where does the red markup come from? How can it be overridden? How can it be overridden?

Where did that Red Markup Come From? Ask Themer

And When Themer Fails to Tell You? Use the information at hand as a starting point: Use the information at hand as a starting point: –What is the source of this page/block Selected Template? View? Feed? Panel? CCK? Selected Template? View? Feed? Panel? CCK? Answering that should give a major clue as to where to begin your search Answering that should give a major clue as to where to begin your search –Next search through the files in the base directory If the module contains a “theme” directory, start there If the module contains a “theme” directory, start there If all else fails, check /includes/theme.inc and other.inc files in /includes or the /modules directory. If all else fails, check /includes/theme.inc and other.inc files in /includes or the /modules directory. Returning to our example, the three highlighted lines came from 3 sources! Returning to our example, the three highlighted lines came from 3 sources!

Overriding Template Files What Can be Overridden? What Can be Overridden? –Chances are, if it ends in.tpl.php, it can be overridden. –Exception: the module author “forgets” to make a file “overridable” Example: date-navigation.tpl.php Example: date-navigation.tpl.php –A well designed template system for a given module will also allow for overriding based on naming “suggestions” –Other times, you may be able to create your own.

Overriding Theme Functions What can be overridden? What can be overridden? –Chances are if it starts with theme_, template_, or phptemplate_, it can be overridden –Chances are if it’s in your “master” theme template.php file, it can be overridden –Override by pasting the code into your custom template.php file pasting the code into your custom template.php file changing the function name to YOURMODULE_ changing the function name to YOURMODULE_ changing the code as needed changing the code as needed –Note: in most cases you want to add a condition and only override what’s necessary Don’t forget to clear your theme registry! Don’t forget to clear your theme registry!

Theme Override Example: Calendar Empty Day Original Original function theme_calendar_empty_day($curday, $view) { if ($view->date_info->calendar_type != 'day') { if ($view->date_info->calendar_type != 'day') { return ' '."\n"; return ' '."\n"; } else { else { return ' '. t('Empty day').' '; return ' '. t('Empty day').' '; }} Overridden Function Overridden Function function sls_calendar_empty_day($curday, $view) { if ($view->date_info->calendar_type != 'day') return ''; if ($view->date_info->calendar_type != 'day') return ''; else { else { return ' '. t('Empty day').' '; return ' '. t('Empty day').' '; }}

Overriding Views Template Files Virtually all views template files (ending in.tpl.php) may be overridden Virtually all views template files (ending in.tpl.php) may be overridden –Regardless of if they show up after clicking the Theme: information link –Views plugins don't report available templates/overrides –Not all views native template files displayed Example: views-exposed-form.tpl.php may be overridden for a given view, but you won’t see that naming suggestion anywhere on the theme: information link Example: views-exposed-form.tpl.php may be overridden for a given view, but you won’t see that naming suggestion anywhere on the theme: information link In the Views UI, overrides are listed from least-specific to most. In the Views UI, overrides are listed from least-specific to most. For views and many plugins, template suggestions naming patterns found in the UI typically work, but aren't documented. For views and many plugins, template suggestions naming patterns found in the UI typically work, but aren't documented.

Wait, why don’t I just want to solve all my problems with CSS again? 1. Unless you override, you may be forced to use the various classes that are output from CCK and views 2. You need to comment your CSS least you forget why you have CSS like #view-id.field-field-0 {} 3. The CSS will be harder to maintain in most cases. –For example when want to add more fields to the view or change the view layout 4. IMO, the CSS approach will require more "debugging” and will be more prone to cross-browser issues. 5. Overriding allows you to output the exact layout desired 6. The sooner you get your hands dirty with code, the more comfortable you’ll be later.

A few Useful CCK Variables $field_YOURFIELD_rendered $field_YOURFIELD_rendered –Printing this field will output it according to your Display settings (in the same manner as it would come out in the content area) –Use it for finer granularity within a.tpl.php file and/or in conjunction with the drupal_set_content() API call. If you’d like to insert some HTML around your filed, use $field_YOURFIELD[#]['view/safe/ /etc'] If you’d like to insert some HTML around your filed, use $field_YOURFIELD[#]['view/safe/ /etc'] –Example: if (!empty($field_sidebar_right_other[0]['value'])) { echo ($field_sidebar_right_other[0]['value']; echo ($field_sidebar_right_other[0]['value']; } Works in.tpl.php files and wherever else these variables have been made available. Works in.tpl.php files and wherever else these variables have been made available.

Views_embed_view() Embed a view anywhere & any time: Embed a view anywhere & any time: views_embed_view('view_name', 'display_name', args) views_embed_view('view_name', 'display_name', args) –'view_name' is the machine name you assigned to your view –'display_name' is either 'default' or 'displayType_#' e.g. 'page_1' or 'block_3' True regardless if you provide your own names for these displays True regardless if you provide your own names for these displays –args: the optional arguments to be passed to the view set to either $arg1, $arg2, $arg3 if multiple arguments are needed (e.g. $nid, $uid, and $tid) set to either $arg1, $arg2, $arg3 if multiple arguments are needed (e.g. $nid, $uid, and $tid) 'arg1+arg2+arg3' (note single quotes) if multiple work together to form one argument (e.g. term IDs) 'arg1+arg2+arg3' (note single quotes) if multiple work together to form one argument (e.g. term IDs)

Building a Dynamic View Use Case: you want to set a dynamic filter without user input using a node reference Use Case: you want to set a dynamic filter without user input using a node reference $filter = array(); $related_courses_view = views_get_view('related_courses_by_discipline'); $display = 'default'; $related_courses_view->set_display($display); $filter = $related_courses_view->get_item($display, 'filter', 'field_course_discipline_nid'); // Grab the node id from the node reference value set for this node $filter['value'] = $field_course_discipline[0]['nid']; $related_courses_view->set_item($display, 'filter', 'field_course_discipline_nid', $filter); $related_courses_view->build($display); $content.= ' Other '. $field_course_discipline[0]['view']. ' Courses: '; $content.= $related_courses_view->render($display); echo $content;

Where to go from Here Views API: Views API: CCK Docs: CCK Docs: Views Docs: Views Docs: Overriding Themable Output: Overriding Themable Output: Check out the Examples Module: Check out the Examples Module: – (This module hasn't received the publicity it deserves) (This module hasn't received the publicity it deserves)

Q&A Session

Thanks! Feel free to contact me: Feel free to contact me: –daneesia on Drupal