introduction to drupal basics
TRANSCRIPT
![Page 1: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/1.jpg)
DrupalIntroduction to Drupal Basics
Juha Niemi, 2009
![Page 2: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/2.jpg)
Drupal vs. My-own-CMS
• Powerful ready-to-go platform to produce web services and applications
• Open source - Free to use and free to modify
• Open API’s provides easy expandability
• Tested and safe. Regular security updates
• Lots of prepared core functions to ease simple coding tasks
• Lots of ready-made modules and code snippets available
![Page 3: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/3.jpg)
Drupal vs. Some-other-CMS
• Power and scalability based on modular architecture and API’s
• Less out-of-the-box modules and features than some others
• More development tools and small functions that enable the user to build almost any kind of web application
• Active community, helping hand available at drupal.org
![Page 4: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/4.jpg)
File structure
• Extension modules and themes always to sites/ folder
• The modules and themes in sites/all are shared through all sites (multisite configuration)
• Sites/mysite.com contents available only to one specific site
![Page 5: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/5.jpg)
Drupal standalone installation
• Easy installer wizard asks for database access information and stores them in settings.php
• Installer writes the basic tables and data into database
• By default sites/default is used
• Available as any hostname
![Page 6: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/6.jpg)
Drupal multisite installation
• Easies way to install a site in multisite configuration:
• Create sites/mysite.com folder (mysite.com is your site’s hostname)
• Duplicate sites/default/settings.php to that folder
• Create sites/mysite.com/files folder and give 777 permissions
• Run installer wizard
![Page 7: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/7.jpg)
Drupal terminology INode
• The general term for all stored content; articles, pages, news...
• Ability to create new content types with a simple GUI (D5+)
• Ability to extend content types beyond standard title+body fields (with CCK module)
Taxonomy
• Content categorization system in core
• Predefined categories (vocabularies)
• Hierarchical terms
• Free tagging
• Single or multiple terms per content
• Multiple vocabularies per content
![Page 8: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/8.jpg)
Drupal terminology II• Block
Small pieces of content that are usually presented in sidebars: menu links, news topics, etc
• Module
Extension modules can expand and modify Drupal’s core funcionalities and normal behaviours
• Theme
The layout and output in general what Drupal generates in HTML
• Core
Drupal core files, that should never be modified, added or removed
![Page 9: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/9.jpg)
User managementUsers
• User UID 1 is the root user
• Profiles with custom fields
• Can be used with external authentication (LDAP, OpenID)
Roles
• Access control defined by roles
• User can have multiple roles
Access to nodes (in core)
• Access granted per role / content type
• Cannot restrict read access by default, except for all content
ACL modules (nodeaccess)
• Extends the core access control
• Show/edit/delete grants can be given for roles and individual users. Even per node.
![Page 10: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/10.jpg)
Modules• Always store under sites/ folder
• The core provides ‘hooks’ that modules can attach to
• Some very often used hooks:hook_form_alterhook_cronhook_nodeapi
• Developer resources available athttp://api.drupal.org
![Page 11: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/11.jpg)
Themes
• PHPTemplate engine (other theme engines available)
• Zen theme (xhtml/css) - great, clean way to start theming
• Overriding theme functions without modifying or breaking any code in core/modules
• Block regions - can be added when needed
![Page 12: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/12.jpg)
Essential module: Views
• GUI to build queries from content, users, files
• Multiple displays (page, block, embed)
• Type how the data is selected from database (full nodes/fields)
• Output styles (list, table, node view)
• Filters (=‘WHERE’ clause), sort order definable
• Arguments provide way to modify the filters based on URL
![Page 13: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/13.jpg)
Essential module: CCK• Drupal allows creation of new
content types (e.g. page, news, event)
• Regular content type only has fields title and the body text
• CCK allows content types to be extended easily with additional fields
Some commonly used fields (fields are modules that expand cck)
• Text field
• Select list
• Image field
• File field
• Date field
• Link field
![Page 14: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/14.jpg)
Node API
• Enables modules to interact with nodes. Data can be added, modified and removed
• Additional data can be shown when node is shown
• hook_nodeapi is called when nodes are stored, edited, viewed, deleted, searched, etc...
![Page 15: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/15.jpg)
Form API
• API that handles programmatical form creation and renders them as usable HTML forms
• All system forms and forms provided by additional modules are created using Form API
• Modules can modify forms that are created by other modules
![Page 16: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/16.jpg)
Menu System
• URL to callback mapping
• Modules can implement new menu items, that initiate a function when a user enters a certain URL
• Menu items can be displayed as
• Links in navigation
• Tabs
• Hidden callbacks
![Page 17: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/17.jpg)
Input formats
• Filtered / Full HTML for standard text and HTML content
• PHP Code allows PHP code to be run as a part of the node
• Simple code can be put in nodes
• More complex code should be put in a module instead
• Input format modules can be added (wiki, textile, etc)
![Page 18: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/18.jpg)
URL aliases
• Essential part of succesful search engine optimization
• Manual paths can be given to any node or other paths
• Pathauto provides automatic URL creation mechanism based on user-definable terms and other data, for example mysite.com/news/2009/01/05/my-news
![Page 19: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/19.jpg)
Updating Drupal
• Drupal core should be kept up-to-date
• Updates can be rolled by overriding the core files and run update.php script
• Minor version updates should be always safe
• Major version updates are usually not recommended because of module incompatibilities and significant code changes
• Backup the database manually prior to every update
![Page 20: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/20.jpg)
Good practices
• Root -user should be used only for low-level configuration and an additional admin role should be created
• Use a right role for the right kind of task when testing
• End user usually runs into problems that the admin role didn’t encounter
• Set-up framework first before adding any content (languages, user management, pathauto’s, etc...)
![Page 21: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/21.jpg)
Valuable resources
• Pro Drupal Development (2nd edition) bookJohn VanDyk, Apress 2008
• http://drupal.org forums and module issue cues
• http://api.drupal.org
![Page 22: Introduction to Drupal Basics](https://reader033.vdocuments.mx/reader033/viewer/2022050817/557cb25cd8b42abf328b4c9a/html5/thumbnails/22.jpg)
About the authorJuha Niemi (Mr.) is the lead web developer and
entrepreneur at Juha Niemi Design Ltd, Finland. He has been using and committed to
Drupal since 2006.
http://www.jnd.fi