1 Customization and theming
2 Actions snippets
2 Send an email to everyone in a role group
6 PHPTemplate Theme Snippets
6 A guide to adding your own snippets
6 guidelines
6 description
6 Step 1 of 2
7 Step 2 of 2
7 Notes
7 Customising full page layouts and sections
7 description
8 usage
8 available variables
9 Customising the full page layout and sections based on node type
9 description
9 usage
9 Step 1 of 2
9 Step 2 of 2
Customising the full page layout and sections using CSS and unique BODY Class
10 IDs
10 description
10 usage
11 Step 1 of 2
12 Step 2 of 2
12 notes
12 Customising the full page layout and sections based on path and taxonomy terms
12 description
12 usage
12 Step 1 of 2
13 Step 2 of 2
13 adding more layouts
13 tips and more examples
14 front page layout switcher for your page.tpl.php file
14 description
14 usage
15 notes
15 display/hide content only on the front page
15 description
15 usage
15 admin theme switcher snippet for your page.tpl.php file
15 description
15 usage
16 Customising node layouts
i
Drupal Handbook 25 Aug 2006
16 description
16 usage
16 Available variables
17 Customising the image gallery node layout
17 description
17 benefits
17 step 1 of 2
18 step 2 of 2
20 Customising blog nodes layout
20 Available variables
20 Default template
21 Splitting your main blog content into (x) multiple columns
21 Description
21 Usage
21 Notes:
22 Inserting Taxonomy Images into nodes
22 description
23 usage
23 step 1 of 2
23 step 2 of 2
24 Extract the ’read more’ link and display it separately somewhere else in your nodes
24 description
24 Customising flexinode layouts
24 description
24 step 1 of 2
25 step 2 of 2
25 example node-flexinode-n.tpl.php file
25 customising flexinode teasers and full view layout
25 description
25 usage
27 handling image fields in your node-flexinode-n.tpl.php files
27 description
27 usage
27 simple image handling
27 advanced image handling
27 notes
27 handling textarea fields and checking input formats
27 description
28 usage
28 simple textarea snippet
28 advanced textarea snippet
28 notes
28 ignoring empty fields
28 description
29 usage
29 Simple text field example
29 Simple image field example
29 notes
Inserting "Submitted by", "time & date" and "number of comments" in your
9 node-flexinode-n.tpl.php file
29 description
29 usage
30 Customising how the time and dates (timestamp) are displayed
30 The Quick Version
30 Create template.php
30 Create flexinode_timestamp.tpl.php
31 The Long Version
31 1. find the theme function for the flexinode field
31 2. Create template.php and add override function
32 3. Create flexinode_timestamp.tpl.php to do formatting
32 Example Files
33 template.php
33 flexinode_timestamp.tpl.php
34 Customising the user list layout
34 description
34 Step 1 of 2
34 Step 2 of 2
35 Notes
35 Customising the user list layout (Update for Drupal 4.7)
35 description
36 Step 1 of 2
36 Step 2 of 2
37 Notes
37 hide a user profile depending on role or a custom field
37 description
37 Usage
37 Step 1 of 2
37 Alternatively
38 Step 2 of 2
38 Customising the user profile nodes
38 The concept
38 Getting Started
39 How to use these snippets
39 Adding new snippets
40 A basic User Profile Page to help get you started
40 Description
40 Usage
40 Customising the user profile pages (a "before" and "after" example with screenshots)
40 Before
41 After
41 How I did it
42 User Profile avatar/picture Snippet
42 Description
42 Usage
42 Handling single-line profile fields
42 Description
43 Usage
43 Handling multi-line profile fields
43 Description
43 Usage
43 works with Drupal 4.5.x and Drupal 4.6.x
44 works with Drupal 4.7.x
44 Handling checkbox profile fields
44 Description
44 Usage
44 Handling freeform profile fields
. 44 Description
45 Usage
. 45 Handling URL profile fields
. 45 Description
46 Usage
. 46 Recent weblog entries (titles) snippet
. 46 Description
46 Usage
. 47 Recent weblog entries (titles & teasers) snippet
. 47 Description
47 Usage
48 Add/delete to/from buddylist snippet
. 48 Description
48 Usage
48 Display a list of buddies snippet
. 49 Description
49 Usage
. 49 Display list of (x) recent posts (titles) snippet
. 49 Description
50 Usage
. 50 User "history" or "member for: (time)" snippet
. 50 Description
51 Usage
51 allow users to choose whether certain profile fields are visible or hidden
. 51 description
. 51 example application
51 usage
. 51 Step 1 of 2
. 52 Step 2 of 2
52 concise version of the same snippet without comments
52 Notes
Display a customisable "this user is [online/offline]" status message in the User Profile
. 52 page
. 52 Description
53 Usage
iv
25 Aug 2006 Drupal Handbook
. 53 Display a user friendly text message when profile fields are left blank
. 53 Description
54 Usage
. 54 Display recent nodes (titles & teasers) snippet
. 54 Description
54 Usage
. 55 Display user submitted images in their profile page
. 56 Insert user friendly "click here to add your.." links when user profile fields are left blank
. 56 Description
56 Usage
. 57 Display a date related notice or countdown snippet
. 57 Description
57 Usage
. 58 Send private message snippet
. 58 Description
58 Usage
Display a Skype "Call me" or "leave a voicemail" button depending on Users’
. 59 online/offline status
. 59 Description
59 Usage
59 Notes
60 Display users age based on a date-of-birth field
. 60 Description
60 Usage
. 61 insert a "view your order history" and "view [username]s store" link
. 61 description
61 Usage
61 View order history link
. 61 View [username]s store link
. 62 Show/hide certain profile fields depending on user role or user permissions
. 62 description
62 Usage
62 show content based on user permissions
. 62 show content based on user role.
62 Adding next & previous links for node types within taxonomy terms (e.g. Image Galleries)
. 62 description
63 step 1 of 2
64 step 2 of 2
64 available variables
. 64 notes
64 Customising how your page headers are displayed for search engines
. 64 Background
. 65 Changing how your page titles are constructed
65 Step 1 of 1
. 65 Available variables
66 How other famous sites format their page title tags
66 Headline only
v
Drupal Handbook 25 Aug 2006
. 66 Site name, headline
. 66 Site name, section, headline
67 Headline, site name (Drupals default TITLE tag format)
. 67 Site name, headline, date
. 67 Site name, date, headline
67 site name only
68 Make images square
69 Customising how links ($links) are displayed in your pages
69 Step 1 of 2
69 Step 2 of 2
. 70 Overriding the delimiter (the character that seperates links) in primary/secondary links
. 70 Description
70 Notes
71 Customise "submitted by" information based on node type
. 71 description
. 71 Customising how the primary or secondary links are displayed
. 71 Description
. 72 Notes
72 Customising the search box
72 Step 1 of 2
73 Step 2 of 2
. 73 Notes
73 Primary links "active" or "selected" highlight snippet
. 73 description
. 74 usage
74 step 1 of 2
. 74 notes
74 Split a text field into multiple columns, like a newspaper/magazine article.
. 75 description
. 75 usage
75 Step 1 of 2
76 Step 2 of 2
. 76 notes
76 Split theme(’page’) $content into multiple sections
. 77 Trim a text field to a certain word length
. 78 description
. 78 usage
78 Step 1 of 2
78 Step 2 of 2
. 79 notes
80 Site recipes
. 80 Choices in Navigation - An Overview
. 80 The Role of Themes
. 81 Conventions
81 Primary/Secondary Navigation
81 More Information:
. 81 Pros
vi
25 Aug 2006 Drupal Handbook
. 81 Cons
. 81 Menu Module
82 More Information:
. 82 Pros:
. 82 Cons:
. 82 Book Module
83 More Information:
. 83 Pros:
. 83 Cons:
. 83 Taxonomy
83 More Information:
. 84 Pros:
. 84 Cons:
. 84 Hard Coded Block
84 More Information:
. 84 Pros:
. 84 Cons:
85 Configuring Drupal for Media: a step-by-step recipe
85 First Steps
. 86 Install and Turn on Modules
. 87 Putting the theme together
. 88 Block Configuration
88 General Settings
. 89 Module Configuration
89 Event, Location, and Flexinode Configuration
. 90 Aggregator Configuration
90 Audio Configuration
91 Blog, Comment, Contact, Forum Configuration
91 Image Configuration
. 92 Path Configuration
93 Playlist Configuration
93 Tracker, TinyMCE, Img_Assist Configurations
. 93 Upload, Frontpage, Video Configurations
94 Access Control and Permissions
. 94 Creating a hierarchical website with taxonomy
101 HOWTO turn Image Galleries into a simple shopping cart
. 107 Single user blog - basic
108 Modules
108 settings
. 109 access control
. 109 access control
109 themes
109 workflow
110 content
. 110 Creating a static archive of a Drupal site
. 112 Troubleshoot your theme
. 112 Validate! Always. Validate XHTML 1.0 Strict.
vii
Drupal Handbook 25 Aug 2006
. 112 Your page should not look the same everywhere
112 Tools for managing inconsistencies in your theme
. 113 Cross browser compatibility (FireFox, Internet Explorer, Opera, Safari)
. 113 Color and graphic issues
. 114 Selecting a base theme
114 Module specific CSS
114 Actually debugging problems in your theme
This page was written by Kieran Lal, and Trae McCombs from CivicSpace Labs with
Theodore Serbinski. If you would like to contribute or help make Drupal theming easier join the
. 114 themes mailing list, or contact Kieran.
115 Basic theme help
. 115 Theme Goals
115 Improving theme help in Drupal
115 Basic Drupal theme tasks
. 116 Difficult theme tasks
. 117 Views snippets
. 117 Display a View of nodes with front_page
117 Replacing blog.module with views
119 The simple monthly archive
122 PHP snippets
NEVER just copy paste without looking at what it does, a user could potentially add a
122 snippet that wipes your complete database!
. 122 A guide to submitting your own PHP snippets
122 PHP block snippets
. 123 A "book-like" navigation block
124 Block Code to Display Particular Forums
125 Blogroll based on aggregator feeds
. 125 Blogroll based on custom profile field
126 Blogroll based on Weblinks, linking straight to destination
127 Blogroll based on Weblinks limited by taxonomy term(s), linking straight to destination
128 Book Module: How to make a book navigation block appear on all pages.
. 128 description
129 usage
. 130 Code to display block only for forums
. 130 count nodes of a particular type, calculate percentage of a target, and link to the latest
. 131 Custom image block for an embedded gallery
132 Display only the latest item from a feed.
. 132 Display tags as cloud
. 134 Display the cover image of most recent bookreview
. 134 Geotargeting block
. 135 Latest stories block
136 Latest Weblinks, which go to the destination, not the node
. 136 Most Popular Content In Parent Term
. 137 Most popular/commented threads
. 137 Moving locked Navigation menu items to your custom block
. 139 My Blog link
139 Pulldown top level category links
viii
25 Aug 2006 Drupal Handbook
140 Random image from a particular category/gallery
141 Show a list of (x) most recent nodes from any of several categories (terms)
141 Show block content only to certain roles
142 Show block to certain users or roles only
144 Show last 5 nodes by users on their profile pages
145 Submission queue block
. 145 Debugging the path
. 146 Custom login
. 146 All published content in a list
147 Blog categories
147 Blogger style ’About Me’ block
148 Categories block as in 4.5
149 Simplified blogger style "About me" block using user profile fields
149 Usage
150 Blogcentric random image
. 150 Hits by month
151 Comment approval count block
152 Counter (x days before / past...)
. 152 Paypal blocks
153 Show highest contributers to a site
153 Top users by comment number
154 Uptime and load on Unix systems
155 PHP page snippets
. 155 How to insert and use the PHP Snippets in your pages
155 More sophisticated layout/styling of node pages
156 How to use the PHP Snippets with the front_page.module
156 USING PHP SNIPPETS WITH THE FRONT_PAGE.MODULE
. 157 Display (x) full flexinodes in a page
157 8 last logged in userpictures on a page for communities
. 158 Allow a user to change a ’sorted’ snippet from DESC to ASC and back again
. 159 Basic Next/Previous Navigation For Nodes
. 160 Check If Book Node Is the Parent Of Another
161 Convert An Address To Its Alias
. 161 Countdown (x) days to a specific date and display a dynamic message
. 162 Creating a paged list of nodes from a taxonomy category, with teasers.
163 Custom user profile page with (x) latest weblog entries of that user
165 Determine file extension of file value field in flexinode and display file type or icon
165 Diplay a list of nodes not part of a book
Display (x) most recent nodes of any or all types and categories and highlight excerpt,
166 creation date and author of latest
. 169 Display (x) nodes from a multiple categories
170 display (x) random thumbnails in a page
. 171 Display (x) random users with their name and avatar
171 Display (x) recent nodes (with teasers) of a specified type from a specified taxonomy term
Modification of code to display one node with teaser followed by a list of the following
172 ’x’ node titles with links to each node
. 173 Modification of snippet to show nodes from more than one taxonomy term
ix
Drupal Handbook 25 Aug 2006
Display a "Hello" message utilizing fields from profile.module and say "Happy Birthday"
. 173 if it’s a users birthday!
. 175 Display a list of (x) most recent weblog entries
Display a list of (x) node titles and links to the full node from multiple
175 taxonomy/category terms
176 Display a list of (x) node titles of a specific type
177 Display a list of (x) upcoming events in a scrolling box without javascript
177 Display a list of a certain content type, with teasers
178 Display a list of node titles from a specific category
179 Display a list of node titles in a category with links to the full term
179 Display a list of node titles of a specific type, within certain dates/times
. 180 Display a list of node titles of a specific type, within a certain time period from today
181 How to split the results into separate pages if the snippet returns lots of results
182 Display a list of node types with comment count, last post w/links
Display a list of term titles(x) from a specific vocabulary with the number of nodes in each
. 183 term
. 184 Display a list of the next (x) upcoming events
184 Display all RSS feeds within a Category and the top 5 articles for each feed.
186 Display avatar based on information from the query string
186 Display block content by module
. 187 Display different page content to anonymous and authenticated users
. 187 Display just the main body of a specific node
188 Display logs summarized by date and host
188 Display some admin-tasks
189 Display the (x) most recent nodes in full from a specific category
. 190 Display the (x) most recent weblog entries from a specific user
. 191 Display the (x) most recent weblog entries with teasers & info.
. 191 Display/hide content from a specific IP address within a page
192 Display/Hide content from a list of IP addresses stored in your database
193 Find and list broken links
. 194 Fix Comment Count
194 Fix Node Teasers
. 195 Front_page snippet: determining if a HOME link is internal or external for splash pages
196 How to split results into separate pages for php snippets that return lots of results
How to split results into separate pages AND allow a user to change a ’sorted’ snippet
. 199 from DESC to ASC
200 Pagination - The Drupal Way
203 HOWTO: Display some arbitrary HTML on a specific page based on the URL you are on
. 204 Insert a quicklist of recent forum topic titles and links
. 204 Insert an image before the promoted nodes on the frontpage
205 Insert the most recent poll
. 205 Latest Blog Entry from Selected Users
. 206 List of nodes by Year and Month/day
Modification of "List of nodes by Year and Month/ Day" snippet with flexinode date
. 207 field sorting and page numbering
maintenance redirect: automatically redirecting everyone but you away from the drupal
. 210 site
x
25 Aug 2006 Drupal Handbook
. 211 Move and redirect your article to another site
211 MySQL Tuning Snippet
. 222 Packaging your PHP snippets
. 225 Placing the contents of a block in any location
226 Printing PHP variables from GET or POST forms
. 226 Private Unpublished Content
. 227 Recent updates: latest added or changed nodes in a site
227 Specify the exact order for nodes that have been promoted to the front page
228 Taxonomy Tree with feed links
230 The drupal.org handbooks page
230 Using more than one php snippet in the same node (or front_page)
231 why?
. 231 Theme snippets
. 231 A very different pager
. 236 Custom login
. 236 Display only tags (and not other category types) below nodes
237 get a contextual array for your node-links
238 How to display mission on every page?
238 Inserting HTML into node titles
. 239 International menus
240 Overriding drupal.css; two approaches
241 search results as teasers (make data not show up)
242 Two columns of teasers
243 SQL snippets
NEVER just copy paste without looking at what it does, a user could potentially add a
243 snippet that wipes your complete database!
243 How to use an SQL snippet
244 Using command line tools
244 Using web-based DB admin tools
. 244 Clearing Drupal’s cache
244 Enable or disable a module
. 245 Insert list of US states into a taxonomy
. 246 Obtain a list of modules
. 246 Obtain a list of themes
. 247 Theme developer’s guide
247 Theming overview
248 Creating custom themes
249 Regions in themes
249 PHPTemplate theme engine
249 Installing PHPTemplate
. 250 Creating a new PHPTemplate
. 250 Box.tpl.php
. 250 Available variables
. 251 Default template
251 Comment.tpl.php
. 251 Available variables
. 251 Default template
xi
Drupal Handbook 25 Aug 2006
. 252 Node.tpl.php
. 252 Available variables
. 252 Default template
. 253 sort taxonony links ($terms) by vocabulary ($vid)
254 Theme distinct node types differently
. 254 Theme teaser to look different than full node
. 254 Page.tpl.php
. 254 Available variables
. 255 Default template
257 $page==0 or $is_front
. 258 Alternative templates for different node types
258 node-og.tpl.php
. 258 Create a theme for a specific flexinode type
. 259 Block.tpl.php
. 259 Available variables
. 260 Default template
260 Changed in 4.7
260 Creating a separate admin theme
. 261 Working with template_file
262 Separate Administration Theme
. 262 Custom Front Page
263 Stand-alone Login Page
264 Making additional variables available to your templates
266 Overriding other theme functions
. 267 Not including drupal.css
267 Regions in PHPTemplate
268 XTemplate to PHPTemplate conversion
269 XTemplate theme engine
. 270 Creating a new XTemplate
271 Template basics
271 Section Tags
. 271 Item Tags
272 Header section
. 272 The Section
272 Prolog
. 272 DOCTYPE
. 273 {head_title}
273 {head}
273 {styles}
. 273 {onload_attributes}
273 {logo}
. 274 {site_name}
274 {site_slogan}
. 274 {secondary_links} {primary_links}
. 274 Search Box
. 275 {search_url}
. 275 {search_description}
xii
25 Aug 2006 Drupal Handbook
275 {search_button_text}
275 Mission
. 275 {mission}
275 Title
275 {title}
275 Tabs
276 {tabs}
276 {breadcrumb}
276 Help
276 {help}
. 276 Message
. 276 {message}
. 276 HOWTO: Allow PHP in primary links in XTemplate
. 278 Node section
. 278 The Node Section
278 {sticky}
278 Picture
. 278 {picture}
278 Title
279 {link}
279 {title}
. 279 {submitted}
. 279 Taxonomy
. 279 {taxonomy}
. 279 {content}
279 Links
280 {links}
280 Comment
280 The Comment Section
280 Avatar
280 {avatar}
280 Title
281 {link}
281 {title}
. 281 Submitted
. 281 {submitted}
281 New
281 {new}
281 Content
. 281 {content}
281 Links
282 {links}
282 Blocks
. 282 The Section
282 {blocks}
282 Block
. 282 {module}
xiii
Drupal Handbook 25 Aug 2006
282 {delta}
282 {title}
. 283 {content}
283 Footer
. 283 The Footer Section
. 283 Message
. 283 {footer_message}
283 {footer}
. 283 Editing with Golive
283 Set Up
284 Editing
284 Plain PHP themes
. 285 Required functions.
286 Directory names
286 Theme coding conventions
. 287 list of classes
. 288 Smarty theme engine
. 288 ’templates_c’ Directory Permissions
. 289 If you have chown access:
289 More likely - no chown access:
289 Installing Smarty theme engine
. 290 Updating your themes
. 290 Converting 3.0 themes to 4.0
. 290 Required changes
. 290 Changes in class definition
290 Changes in function header()
. 291 Changes in function node()
291 Changes in function comment()
. 292 Changes in function footer()
. 292 Optional changes
292 New function: system()
. 292 Converting 4.0 themes to 4.1
. 292 Required changes
. 292 Optional changes
292 theme_head
. 293 Converting 4.1 themes to 4.2
. 293 Required changes
. 293 Add a theme_onload_attribute() to a tag:
. 293 Optional changes
. 293 Take advantage of settings() hook
. 293 Direct you site logo to index.php
. 294 Converting 4.2 themes to 4.3
. 294 Converting 4.3 themes to 4.4
. 296 Converting 4.4 themes to 4.5
. 296 Directory structure
297 Tabs (a.k.a. Local Tasks)
298 Status Messages
xiv
25 Aug 2006 Drupal Handbook
298 Static vs. Sticky
298 Avatar vs. User Picture
. 299 Theme Screenshots
. 300 Centralized Theme Configuration
301 Styles
. 302 _help hook
. 302 Converting 4.5 themes to 4.6
. 302 Search form
. 302 Node links
302 Pages
302 Node and comment markers
303 Pager and menu item themeing
303 Text validation changes
. 303 Converting 4.6 themes to 4.7
. 303 Table row coloring
. 303 $site removed from page.tpl.php
. 303 $seqid is now $id
303 New theme_username()
304 theme_node: $main => $teaser
304 Regions
. 305 theme_comment_thread_min() and theme_comment_thread max() renamed
. 305 Forum icons now controlled by the theme
. 305 Drupal.css changes
. 305 We no longer use the element
. 305 theme_onload_attribute has been removed; use JS addLoadEvent() instead
306 Using Theme Override Functions
306 Which File to Use
. 306 How to Name your Override Function
. 307 Theme screenshot guidelines
. 309 Theme how-to’s
309 Basic instructions for adding graphic tabs to your Drupal theme
. 312 Displaying random images
312 Making your theme semantically correct.
. 312 Headers
313 Tips for designing themes in Dreamweaver, GoLive etc.
313 Dreamweaver
. 313 In Extensions.txt
313 In MMDocumentTypes.xml
314 Adding your theme to Drupal.org
| Attachment | Size |
|---|---|
| Installation_and_upgrading.pdf | 2.99 MB |