openbit szkolenie-drupal-podstawy 2

Download Openbit szkolenie-drupal-podstawy 2

If you can't read please download the document

Upload: grzegorz-bartman

Post on 18-Jun-2015

189 views

Category:

Technology


2 download

DESCRIPTION

Openbit szkolenie-drupal-podstawy 2

TRANSCRIPT

  • 1. Drupal basics Part 2

2. Training plan Taxonomy Users management Creating new content types with CCK module Image management (imagecache, galleries) page 2/57 3. Taxonomy The taxonomy module allows you to categorize your contentusing both tags and administrator defined terms. It is a flexibletool for classifying content with many advanced features. Taxonomy administration page: admin/content/taxonomyCreate newvocabularyList of vocabulariespage 3/57 4. Create vocabularyVocabulary name: Car brand Content type: Car Settings page 4/57 5. Add term to vocabulary Add termTerm nameAdvanced options:parents, synonims,related terms page 5/57 6. Create content with taxonomyTaxonomy options:Car brandpage 6/57 7. Create content with taxonomyTaxonomy options:Car brandpage 7/57 8. Taxonomy term pageTerm nameNodes assignedto term Page: taxonomy/term/1 page 8/57 9. PracticeCreate 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. More practiceCreate content type News: enabled comments,published on front pageCreate vocabulary News category and add someterms (Business, Sport, Technology, etc...). Usercan select one optionCreate vocabulary News tags and enable optionTagsCreate 5 news nodes, assign News category andad tagspage 10/57 11. Page taxonomy/term/TIDtaxonomy/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. Term hierarchy (1)Terms can have hierarchy (parent - children)Select parentpage 12/57 13. Term hierarchy (2)Hierarchy of termspage 13/57 14. Users basic informationsIn Drupal you can create users accountsEach user has name and numeric identificator(uid)After installation Drupal has one user administrator (uid = 1)Administrator has access to all optionsYou can assign roles to userYou can assign permissions to rolespage 14/57 15. Users roles - permissions Roles(anonymous, authenticated,moderator, editor)PermissionUsers(access user profiles,(admin, joe, steve) create story content,access comments)page 15/57 16. RolesDefault roles after installation anonymous user all not logged in users authenticated user all logged in usersYou cant delete default rolesYou can create unlimited number of new roles page 16/57 17. Create new role New role namePage: admin/user/roles page 17/57 18. Role permissions Set permission to role: create page, story, car delete any page,story, car edit any page, story, carPage: admin/user/permissionspage 18/57 19. Inheritance permissions Inheritance of logged-on user permissions.No need to select if permissions are assignedto the role authenticated userPage: admin/user/permissionspage 19/57 20. Users management Add new userFilter optionsUpdate optionsUsers list Page: admin/user/userpage 20/57 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. Users list User name Assigned rolesEdit linkPage: admin/user/user/create page 22/57 23. PracticeCreate roles and assign permissions: car editor, permissions: create, edit and delete car story editor, permissions: create, edit and delete storyCreate users: user2 role car editor user3 role story editorLog in as user2 and user3 and checkpermissions page 23/57 24. CCKCCK Content Construction Kithttp://drupal.org/project/cck (Drupal 7 has thismodule in core)Default node has title and bodyCCK allow to create additional fields for nodes(text fields, files upload, select lists, checkboxes, references to other nodes and users)page 24/57 25. Installing CCK (1)Go to http://drupal.org/project/cck, downloadmodule and extract files intosites/all/modules/contribGo to admin/build/modules and enablemodules: Content Fieldgroup Node reference Number Option Widgets Text page 25/57 26. Installing CCK (2) page 26/57 27. Using CCKGo to edit content type Car: admin/content/node-type/carNew options:Manage fields andDisplay fieldspage 27/57 28. CCK: Manage fieldsCurrent node fields(defaults). You canchange order of fields.Create new fieldCreate new group of fieldspage 28/57 29. CCK: Creating new field (1)Label Field name (stored in database asField type and fieldidentificator). Best practice: always insert widgetnode type as field name prefix, example:field_story_author, field_page_informationpage 29/57 30. CCK: Creating new field (2)Help text, displayed under fieldon node add formRequiredNumber of allowed valuesMinimum and maximum valuePrefix and suffix. cc cubic centimeterspage 30/57 31. CCK: Creating new field (3)New field Configure and Remove linksPage: admin/content/node-type/car/fields page 31/57 32. CCK: Creating new field (3)New field Configure and Remove linksPage: admin/content/node-type/car/fields page 32/57 33. CCK: Creating new field (4)New field on node add pagePage: node/add/carpage 33/57 34. CCK: Creating new field (5)Node view page: node/[nid]Node titleNode body New fieldTaxonomy terms page 34/57 35. CCK: Display fields (1) Label optionsDisplay format ExcludePage: admin/content/node-type/car/display page 35/57 36. CCK: Display fields (2)Display options: Label inline Format: 9 999page 36/57 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. Extending CCK Add new field type: file upload Go to http://drupal.org/project/filefield, download and extract module into sites/all/modules/contrib Go to admin/build/modules and enable FileField moduleFileField modulepage 38/57 39. FileField module (1)Go to admin/content/node-type/car/fields andadd new fieldField type: Filepage 39/57 40. FileField module (2)Allowed files extensionsFile size restrictionsNumber of values: set tounlimitedpage 40/57 41. FileField module (3) Go to node/add/car and add content with filesFile upload options page 41/57 42. FileField module (4)Node view page Uploaded files page 42/57 43. PracticeCreate new field: Documents field type: file upload, unlimited number of valuesCreate new group of fields, label: Files, name group_car_filesInsert fields Manuals and Documents into group FilesNode add pageField group: Filespage 43/57 44. PracticeCreate new group of fields, label: Details, name group_car_detailsInsert fields Engine size, Gears, Gearbox, Kerb weight,Door count into group DetailsGroup: Detailspage 44/57 45. Extending CCK: Images ImageField module provides an image upload field for CCK. Go to http://drupal.org/project/imagefield, download and extract files into sites/all/modules/contrib Go to admin/build/modules and enable module ImageFieldImageField module page 45/57 46. ImageField (1)Go to Content management Content types Edit Car Manage fieldsCreate new field: Photos, field_car_photosField type: File - Image page 46/57 47. ImageField (2)Allowed image extensionsImage options: ALT, Title,Default imagepage 47/57 48. ImageField (3)Go to Content management Create content CarPhotos upload options page 48/57 49. ImageField (4)Node view page:Uploaded photos page 49/57 50. ImageCache moduleImageCache allows you to setup presets for image processing.Go to http://drupal.org/project/imagecache, download and extractfiles into sites/all/modules/contribGo to http://drupal.org/project/imageapi, download and extractfiles into sites/all/modules/contribGo to Site building Modules and enable modules: ImageAPI ImageAPI GD2 ImageCache ImageCache UIpage 50/57 51. ImageCache presets (1)Go to Site buliding ImagecacheAdd new presetAdd action: ScaleAction: Scale page 51/57 52. ImageCache presets (2) Preset edit options NameActionsNew actionsConfigure or delete action page 52/57 53. Using ImageCache presets in CCK (1)Go to Content management Content types Edit Car DisplayfieldsSet options for Photos field: Teaser: hidden Full node: width400px image linked to nodeImageCache preset page 53/57 54. Using ImageCache presets in CCK (2)Create Car node and add some photos larger than 400pxNow all imageshas the samewidthpage 54/57 55. PracticeCreate new ImageCache preset and assign itfor field Photos in Car node typeCreate new field in Story node type: Photos(field_story_photos)Create new Car node and test presetCreate new ImageCache presetAssign new preset for field Photosfield_story_photosCreate new Story node and test preset page 55/57 56. Summary What you should know after this stage?TaxonomyUser managementCreate custom fields for contentCreate ImageCache preset and use it in CCKfieldspage 56/57 57. Thank you for your attention Contact:E-mail: [email protected] Tel: +48 882 515 514strona 57/57