Openbit szkolenie-drupal-podstawy 2


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Openbit szkolenie-drupal-podstawy 2

  1. 1. Drupal basics Part 2
  2. 2. Training plan● Taxonomy● Users management● Creating new content types with CCK module● Image management (imagecache, galleries) page 2/57
  3. 3. Taxonomy● The taxonomy module allows you to categorize your content using both tags and administrator defined terms. It is a flexible tool for classifying content with many advanced features.● Taxonomy administration page: admin/content/taxonomy Create new vocabulary List of vocabularies page 3/57
  4. 4. Create vocabularyVocabulary name: Car brand Content type: Car Settings page 4/57
  5. 5. Add term to vocabulary Add termTerm nameAdvanced options:parents, synonims,related terms page 5/57
  6. 6. Create content with taxonomyTaxonomy options:Car brand page 6/57
  7. 7. Create content with taxonomyTaxonomy options:Car brand page 7/57
  8. 8. Taxonomy term pageTerm nameNodes assignedto term Page: taxonomy/term/1 page 8/57
  9. 9. Practice●Create vocabulary Color for content type Car andadd some terms (black, red, blue, silver, etc...).User must select one option.●Create vocabulary Body type for content type Carand add some terms (hatchback, coupe, etc...).User must select one option.●Create vocabulary Car Equipment for content typeCar and add some terms (ABS, Alarm, ElectricWindows, Traction Control, etc...). User can selectone or more options.●Add some Cars (nodes) and assign taxonomyoptions page 9/57
  10. 10. More practice●Create content type News: enabled comments,published on front page●Create vocabulary News category and add someterms (Business, Sport, Technology, etc...). Usercan select one option●Create vocabulary News tags and enable option„Tags”●Create 5 news nodes, assign News category andad tags page 10/57
  11. 11. Page taxonomy/term/TID●taxonomy/term/[TID] – display nodes assigned toterm [TID]●taxonomy/term/[TID1]+[TID2]+[TID3] – displaynodes assigned to term [TID1] or [TID2] or [TID3]●taxonomy/term/[TID1],[TID2] – display nodesassigned to term [TID1] and [TID2] page 11/57
  12. 12. Term hierarchy (1)●Terms can have hierarchy (parent - children)Select parent page 12/57
  13. 13. Term hierarchy (2)Hierarchy of terms page 13/57
  14. 14. Users – basic informations●In Drupal you can create users accounts●Each user has name and numeric identificator(uid)●After installation Drupal has one user –administrator (uid = 1)●Administrator has access to all options●You can assign roles to user●You can assign permissions to roles page 14/57
  15. 15. Users – roles - permissions Roles (anonymous, authenticated, moderator, editor) Permission Users (access user profiles,(admin, joe, steve) create story content, access comments) page 15/57
  16. 16. Roles●Default roles after installation ● anonymous user – all not logged in users ● authenticated user – all logged in users●You cant delete default roles●You can create unlimited number of new roles page 16/57
  17. 17. Create new role New role namePage: admin/user/roles page 17/57
  18. 18. Role permissions Set permission to role: ●create page, story, car ●delete any page,story, car ●edit any page, story, carPage: admin/user/permissions page 18/57
  19. 19. Inheritance permissions Inheritance of logged-on user permissions. No need to select if permissions are assigned to the role „authenticated user”Page: admin/user/permissions page 19/57
  20. 20. Users management Add new userFilter optionsUpdate optionsUsers list Page: admin/user/user page 20/57
  21. 21. Create new user Username, e-mail and password Status – if „blocked” user cant log in Assigned rolesPage: admin/user/user/create page 21/57
  22. 22. Users list User name Assigned roles Edit linkPage: admin/user/user/create page 22/57
  23. 23. Practice●Create roles and assign permissions: ● „car editor”, permissions: create, edit and delete car ● „story editor”, permissions: create, edit and delete story●Create users: ● user2 – role „car editor” ● user3 – role „story editor”●Log in as „user2” and „user3” and checkpermissions page 23/57
  24. 24. CCK●CCK – Content Construction Kit (Drupal 7 has thismodule in core)●Default node has title and body●CCK allow to create additional fields for nodes(text fields, files upload, select lists, checkboxes, references to other nodes and users) page 24/57
  25. 25. Installing CCK (1)●Go to, downloadmodule and extract files intosites/all/modules/contrib●Go to admin/build/modules and enablemodules: ● Content ● Fieldgroup ● Node reference ● Number ● Option Widgets ● Text page 25/57
  26. 26. Installing CCK (2) page 26/57
  27. 27. Using CCK●Go to edit content type Car: admin/content/node-type/carNew options:Manage fields andDisplay fields page 27/57
  28. 28. CCK: Manage fieldsCurrent node fields(defaults). You canchange order of fields.Create new fieldCreate new group of fields page 28/57
  29. 29. CCK: Creating new field (1)Label Field name (stored in database as Field type and field identificator). Best practice: always insert widget node type as field name prefix, example: field_story_author, field_page_information page 29/57
  30. 30. CCK: Creating new field (2)Help text, displayed under fieldon node add formRequiredNumber of allowed valuesMinimum and maximum valuePrefix and suffix. cc – cubic centimeters page 30/57
  31. 31. CCK: Creating new field (3)New field Configure and Remove linksPage: admin/content/node-type/car/fields page 31/57
  32. 32. CCK: Creating new field (3)New field Configure and Remove linksPage: admin/content/node-type/car/fields page 32/57
  33. 33. CCK: Creating new field (4)New field on node add pagePage: node/add/car page 33/57
  34. 34. CCK: Creating new field (5)Node view page: node/[nid]Node titleNode body New field Taxonomy terms page 34/57
  35. 35. CCK: Display fields (1) Label options Display format ExcludePage: admin/content/node-type/car/display page 35/57
  36. 36. CCK: Display fields (2)●Display options: ● Label inline ● Format: 9 999 page 36/57
  37. 37. PracticeCreate new fields for Car node type:●● Gears – integer, select list (options 4, 5, 6)● Gearbox: - select list (options: manual, automatic)● Kerb weight – integer, suffix „kg”● Door count – integer, select list (options 3, 4, 5) page 37/57
  38. 38. Extending CCK ●Add new field type: file upload ●Go to, download and extract module into sites/all/modules/contrib ●Go to admin/build/modules and enable FileField moduleFileField module page 38/57
  39. 39. FileField module (1)●Go to admin/content/node-type/car/fields andadd new field Field type: File page 39/57
  40. 40. FileField module (2)Allowed files extensionsFile size restrictionsNumber of values: set tounlimited page 40/57
  41. 41. FileField module (3) ● Go to node/add/car and add content with filesFile upload options page 41/57
  42. 42. FileField module (4)Node view page Uploaded files page 42/57
  43. 43. Practice●Create new field: ● Documents – field type: file upload, unlimited number of values●Create new group of fields, label: Files, name group_car_files●Insert fields „Manuals” and „Documents” into group „Files” Node add page Field group: Files page 43/57
  44. 44. Practice●Create new group of fields, label: Details, name group_car_details●Insert fields „Engine size”, „Gears”, „Gearbox”, „Kerb weight”,„”Door count into group „Details” Group: Details page 44/57
  45. 45. Extending CCK: Images ●ImageField module provides an image upload field for CCK. ●Go to, download and extract files into sites/all/modules/contrib ●Go to admin/build/modules and enable module ImageFieldImageField module page 45/57
  46. 46. ImageField (1)●Go to Content management → Content types → Edit Car →Manage fields●Create new field: Photos, field_car_photos Field type: File - Image page 46/57
  47. 47. ImageField (2)Allowed image extensionsImage options: ALT, Title,Default image page 47/57
  48. 48. ImageField (3)Go to Content management → Create content →CarPhotos upload options page 48/57
  49. 49. ImageField (4)Node view page:Uploaded photos page 49/57
  50. 50. ImageCache module●ImageCache allows you to setup presets for image processing.●Go to, download and extractfiles into sites/all/modules/contrib●Go to, download and extractfiles into sites/all/modules/contrib●Go to Site building → Modules and enable modules: ● ImageAPI ● ImageAPI GD2 ● ImageCache ● ImageCache UI page 50/57
  51. 51. ImageCache presets (1)●Go to Site buliding → Imagecache●Add new preset●Add action: Scale Action: Scale page 51/57
  52. 52. ImageCache presets (2) Preset edit options NameActionsNew actions Configure or delete action page 52/57
  53. 53. Using ImageCache presets in CCK (1)●Go to Content management → Content types → Edit Car → Displayfields●Set options for Photos field: ● Teaser: hidden ● Full node: width400px image linked to node ImageCache preset page 53/57
  54. 54. Using ImageCache presets in CCK (2)Create Car node and add some photos larger than 400px● Now all images has the same width page 54/57
  55. 55. Practice●Create new ImageCache preset and assign itfor field Photos in Car node type●Create new field in Story node type: Photos(field_story_photos)●Create new Car node and test preset●Create new ImageCache preset●Assign new preset for field Photosfield_story_photos●Create new Story node and test preset page 55/57
  56. 56. Summary What you should know after this stage?●Taxonomy●User management●Create custom fields for content●Create ImageCache preset and use it in CCKfields page 56/57
  57. 57. Thank you for your attention Contact:E-mail: Tel: +48 882 515 514 strona 57/57