Drupal 7 basic setup and contrib modules for a brochure website

48
1 Drupal – Content Types, Contrib Modules – views etc YIPL Dev Team 31 October 2011

description

How to build a bro

Transcript of Drupal 7 basic setup and contrib modules for a brochure website

Page 1: Drupal 7 basic setup and contrib modules for a brochure website

1

Drupal – Content Types, Contrib Modules – views etc

YIPL Dev Team

31 October 2011

Page 2: Drupal 7 basic setup and contrib modules for a brochure website

2

Agenda• Must have Drupal Modules• Recipe Brochure website• Creating and configuring Content types • Using Views to list content

Page 3: Drupal 7 basic setup and contrib modules for a brochure website

3

Must have Drupal Modules

• In Drupal core– Fields (already on)

– Image Styles (images module)

• Absolute Essential– Views

– Panels– Backup and Migrate– Token (for pathauto and others)

Page 4: Drupal 7 basic setup and contrib modules for a brochure website

4

Must have Drupal Modules 2• Node Related

– WYSIWYG – Ckeditor

– IMCE

– WYSIWYG IMCE Bridge

– Workbench?

• Optional Addon

– Context

– Features

– Views Slideshow (homepage animation)

Page 5: Drupal 7 basic setup and contrib modules for a brochure website

5

Must have Drupal Modules 2

• SEO– Pathauto

– Page Title– Nodewords– XML Sitemap– Global Redirect– Google Analytics– Search 404??

Page 6: Drupal 7 basic setup and contrib modules for a brochure website

6

Module and usage• Information architecture is translated in to content

types and links (node reference) between them.

• CCK (now fields) and other related modules (like node reference + related modules) are used.

• Views are used to show the content in desired format (query generator)

• Other modules like panels are used to give customized display of views and other things.

Page 7: Drupal 7 basic setup and contrib modules for a brochure website

7

A recipe brochure website• Information Architecture below:● Static page

– Title (required)

– Body (required)● News

– Title (required)

– Body (required)

– Image(optional)

– Tags/Category (optional)

Page 8: Drupal 7 basic setup and contrib modules for a brochure website

8

A recipe brochure website 2• Image Gallery with 2 content types● Gallery (1 gallery contains multiple Images)

• Image– Title (required)

– Image(required)

• Gallery and image linked with node reference (use node reference url)

• Some Views – Latest News, Galleries etc

• User Management and permission granting.

Page 9: Drupal 7 basic setup and contrib modules for a brochure website

9

Content type for static page

• It is already there in form of “Basic Page”

• Make sure you are logged in (as admin)

• Click “Structure>>Content Types”

• Click “Edit” under “Basic Page”

Page 10: Drupal 7 basic setup and contrib modules for a brochure website

10

Basic Page settings

• If you want to change title into “Headline” or something you can do it.

• You can change other settings if needed.

Page 11: Drupal 7 basic setup and contrib modules for a brochure website

11

Field Settings

• If you needed other fields (which is not needed now), you can change it from manage fields tab.

Page 12: Drupal 7 basic setup and contrib modules for a brochure website

12

Field labels and other settings

• If you click “edit” under operation of body field you can change its label and settings.

Page 13: Drupal 7 basic setup and contrib modules for a brochure website

13

Basic page is fine

• Basic page is good and serves its purpose as built in core Drupal.

• In Drupal there are two forms for content type/node to be displayed:– Teaser– Full Node

• So settings for fields can be based on display format.

Page 14: Drupal 7 basic setup and contrib modules for a brochure website

14

Translating specs to content types

• Each new kind of content should be a content type.

• Each new information unit can be a field.

• Fields are sharable. (http://drupal.org/node/311138)

• Some Drupal facts to consider– Each content type is a node type (nid)

– Each content/node is created by one user (uid)

– Content types can be related with node ref

– Media (images etc) are handled by Drupal

Page 15: Drupal 7 basic setup and contrib modules for a brochure website

15

Brochure site rough data model

• Below is a rough data model for the site.

• Remember things to consider (prev slide)

Page 16: Drupal 7 basic setup and contrib modules for a brochure website

16

Create News Content Type

• Goto Structure>>Content Types>>+ Add Content Type

Page 17: Drupal 7 basic setup and contrib modules for a brochure website

17

Create News Content Type 2

• Name content type news and other things:

Page 18: Drupal 7 basic setup and contrib modules for a brochure website

18

Create News Content Type 3

• Check publishing options

Page 19: Drupal 7 basic setup and contrib modules for a brochure website

19

Create News Content Type 4

• Check display options

Page 20: Drupal 7 basic setup and contrib modules for a brochure website

20

Create News Content Type 4

• Check comment settings

Page 21: Drupal 7 basic setup and contrib modules for a brochure website

21

Create News Content Type 5

• Check Menu Settings

• Then click “Save and add fields”

• No Menus as “News” don't have any link

Page 22: Drupal 7 basic setup and contrib modules for a brochure website

22

Create News Content Type 6

• Content type created, now add fields.

Page 23: Drupal 7 basic setup and contrib modules for a brochure website

23

Create News Content Type 7

• Add image field for “News Image”.

Page 24: Drupal 7 basic setup and contrib modules for a brochure website

24

Create News Content Type 8

• News photo field settings.

Page 25: Drupal 7 basic setup and contrib modules for a brochure website

25

Create News Content Type 9

• Configure settings for image field.

• Decide if image is required to create news.

Page 26: Drupal 7 basic setup and contrib modules for a brochure website

26

Create News Content Type 10

• Configure image size settings

Page 27: Drupal 7 basic setup and contrib modules for a brochure website

27

Create News Content Type 11

• Other image related settings

Page 28: Drupal 7 basic setup and contrib modules for a brochure website

28

Create News Content Type 12

• Choose default files if any “Save settings”

• Creating content type with image complete

Page 29: Drupal 7 basic setup and contrib modules for a brochure website

29

Order of fields (drag and drop)

• Fields can be ordered by drag and drop.

Page 30: Drupal 7 basic setup and contrib modules for a brochure website

30

Manage display fields

• Configure how to show fields in teaser and default (full node) view

Page 31: Drupal 7 basic setup and contrib modules for a brochure website

31

Other things to consider• Comments are field-able

• Comment fields and display can also be configured.

• Field type should be select as per the need example, date of birth will be a date field and Gender can be a select box with male and female.

• Now new content of type news can be added.

Page 32: Drupal 7 basic setup and contrib modules for a brochure website

32

Add content changed

• News can now be added to the website.

Page 33: Drupal 7 basic setup and contrib modules for a brochure website

33

Create News content

• Other settings same as page/node submission settings.

Page 34: Drupal 7 basic setup and contrib modules for a brochure website

34

News Created

• Remember the dimensions of the image uploaded.

Page 35: Drupal 7 basic setup and contrib modules for a brochure website

35

Need of Views

• Now this is a list and to list nodes, users etc we need the views module.

• Views module is a query generator and list maker which shows content in a predefined format like table, list etc.

• Views can be downloaded from http://drupal.org/project/views , need ctools

• From drush: drush dl views; drush en views views_ui (will download ctools as well)

Page 36: Drupal 7 basic setup and contrib modules for a brochure website

36

Latest 5 news page and block

• To create a view go to: Structure>>Views

Page 37: Drupal 7 basic setup and contrib modules for a brochure website

37

Create a view for News

• How to add a new view.

Page 38: Drupal 7 basic setup and contrib modules for a brochure website

38

Add view for News

• Add a new view “latest_news” with following settings:

Page 39: Drupal 7 basic setup and contrib modules for a brochure website

39

Add view for News 2

• Provide a link and create a block

Page 40: Drupal 7 basic setup and contrib modules for a brochure website

40

Add View for News 3

• Full views scary interface ;)

• Click save and run from here for now.

Page 41: Drupal 7 basic setup and contrib modules for a brochure website

41

Now there is new page

• There is a menu item in menu for News.

Page 42: Drupal 7 basic setup and contrib modules for a brochure website

42

Some Views Jargon• Views is a query generation with display

formatting.

• Display could be simple HTML list, table (data grid) or complicated like views slide-show

• Single view can have multiple displays– Attachment – Attached to other view(s)

– Block – Rendered as a block, shown in block region

– Page – Has a URL, may even have a Menu Link

– Feed – RSS feed for feed readers to consume

Page 43: Drupal 7 basic setup and contrib modules for a brochure website

43

Configure News block

• Goto Blocks (Structure >> Blocks)

• Click “Configure” besides “ - View: latest_news then, add title as below:

• Then click “Save Block”

Page 44: Drupal 7 basic setup and contrib modules for a brochure website

44

Place the news block

• Place the latest news block on sidebar first as shown below (and click “Save Blocks”):

Page 45: Drupal 7 basic setup and contrib modules for a brochure website

45

Latest News block placed

• News block is placed at “Sidebar first”

Page 46: Drupal 7 basic setup and contrib modules for a brochure website

46

Image gallery with content types• Gallery is a content type.

• Picture is another content type.

• One gallery has many pictures.

• One picture can belong to only one gallery.

• 1:m relationship

• How to show this in Drupal?– Node Reference

Page 47: Drupal 7 basic setup and contrib modules for a brochure website

47

Page 48: Drupal 7 basic setup and contrib modules for a brochure website

48

Self Study and Practice• Add tags to News

• Image gallery

• Home page with panels

• Events with Date filters (conditions, calender, previous events, future events etc)

• Team page

• RSS feeds with views

• Module assignment: change “Apply” in views filter to “Search”