Introduction to Drupal Basics

  • View

  • Download

Embed Size (px)


  • 1. Drupal Introduction to Drupal Basics Juha Niemi, 2009

2. 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 APIs 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 3. Drupal vs. Some-other-CMS Power and scalability based on modular architecture and APIs 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 4. File structure Extension modules and themes always to sites/ folder The modules and themes in sites/ all are shared through all sites (multisite conguration) Sites/ contents available only to one specic site 5. 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 6. Drupal multisite installation Easies way to install a site in multisite conguration: Create sites/ folder ( is your sites hostname) Duplicate sites/default/settings.php to that folder Create sites/ folder and give 777 permissions Run installer wizard 7. Drupal terminology I Node Taxonomy The general term for all stored Content categorization systemcontent; articles, pages, core Ability to create new contentPredened categoriestypes with a simple GUI (D5+) (vocabularies) Ability to extend content typesHierarchical termsbeyond standard title+bodyelds (with CCK module) Free tagging Single or multiple terms percontent Multiple vocabularies percontent 8. Drupal terminology II Block ThemeSmall pieces of content that areThe layout and output in general usually presented in sidebars: menu what Drupal generates in HTML links, news topics, etc Core Module Drupal core les, that should never Extension modules can expand andbe modied, added or removed modify Drupals core funcionalities and normal behaviours 9. User management UsersAccess to nodes (in core)User UID 1 is the root user Access granted per role /Proles with custom elds content typeCan be used with external Cannot restrict read access by authentication (LDAP, OpenID) default, except for all content RolesACL modules (nodeaccess)Access control dened by roles Extends the core accessUser can have multiple rolescontrol Show/edit/delete grants can be given for roles and individual users. Even per node. 10. Modules Always store under sites/ folder The core provides hooks that modules can attach to Some very often used hooks: hook_form_alter hook_cron hook_nodeapi Developer resources available at 11. 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 12. Essential module: Views GUI to build queries from content, users, les Multiple displays (page, block, embed) Type how the data is selected from database (full nodes/ elds) Output styles (list, table, node view) Filters (=WHERE clause), sort order denable Arguments provide way to modify the lters based on URL 13. Essential module: CCK Drupal allows creation of new Some commonly used elds content types (e.g. page, news, (elds are modules that expand cck) event) Text eld Regular content type only has elds Select list title and the body text CCK allows content types to be Image eld extended easily with additional elds File eld Date eld Link eld 14. Node API Enables modules to interact with nodes. Data can be added, modied and removed Additional data can be shown when node is shown hook_nodeapi is called when nodes are stored, edited, viewed, deleted, searched, etc... 15. 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 16. 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 17. 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) 18. 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-denable terms and other data, for example 19. Updating Drupal Drupal core should be kept up-to-date Updates can be rolled by overriding the core les and run update.php script Minor version updates should be always safe Major version updates are usually not recommended because of module incompatibilities and signicant code changes Backup the database manually prior to every update 20. Good practices Root -user should be used only for low-level conguration 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 didnt encounter Set-up framework rst before adding any content (languages, user management, pathautos, etc...) 21. Valuable resources Pro Drupal Development (2nd edition) book John VanDyk, Apress 2008 forums and module issue cues 22. About the author Juha 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.