Drupalcon advanced theming techniques
Jump to navigation
Jump to search
- views 2 takes advantage of themes, you can choose what theme to use.
Contents
Anatomy of a theme
- info
- template override
- function override
- theme at module level
.info file
- add stylesheets - css
- add regions to theme
- provide default settings
- include javascripts - jquery libs add-ons
template overrides
- .tpl files containg html markup
- useful for subtheming
function overrides
- make decisions where logic is needed
- better for performance - 5 times more efficient than template files
theming at the module level
- needed for theming new functionality
overriding preprocessing functions
- preprocess functions better than template files
- preprocess funnctions arent hooks!
- sepatrate logic from appearance
- less msintenance
- copy and paste from include into template.php, and change name
- have look in theme registry or test with function_exists(), has it been overridden already?
- if module overrode theme you need to know anytime your theme's overrided, call theme_links or the custom... avoid dependencies on module... prehaps on multi site
subtheming
- take theme closer to final code without writing a line a of code
- use zen as base without having to merge changes
- separate out logic and appearance of theme
- create design1 appearance theme
- have nothing but the css
- create another subtheme called logic that deals with specific modules, client
theming forms
- clear the cache!!
- forms are special case
- target a specific form?
- this form? use this template, this function
- modify individual form elements
- take form object that the form api creates and intercept it
- Theming the User Registration Form in Drupal 6