Difference between revisions of "Drupal documentation"
From Stadm
Jump to navigationJump to search (→Intro) |
|||
(One intermediate revision by the same user not shown) | |||
Line 73: | Line 73: | ||
* This solved the issue of making the title of the articles in the news linked to the URL of the news source | * This solved the issue of making the title of the articles in the news linked to the URL of the news source | ||
** In the fields section under the View module, add Content: URL ( or whatever you need to link to ) and make sure it is on top of the field that you are trying to change its link path to. You can select 'Exclude from display' for the 'Content: URL' not to show up. Then, click on the field that you want to change its link path to the 'Content: URL' and check 'Output this field as a link' and make sure 'Link this field to its node' is not checked. In the Link Path, copy and paste the associated Drupal path of 'Content: URL', for example, [field_news_url_value]. You can find the translation in the 'Replacement Patterns'. Click update then save and you should see the field you selected is linked to the address of the URL field. | ** In the fields section under the View module, add Content: URL ( or whatever you need to link to ) and make sure it is on top of the field that you are trying to change its link path to. You can select 'Exclude from display' for the 'Content: URL' not to show up. Then, click on the field that you want to change its link path to the 'Content: URL' and check 'Output this field as a link' and make sure 'Link this field to its node' is not checked. In the Link Path, copy and paste the associated Drupal path of 'Content: URL', for example, [field_news_url_value]. You can find the translation in the 'Replacement Patterns'. Click update then save and you should see the field you selected is linked to the address of the URL field. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 13:22, 13 January 2015
Documenting procedures on using Drupal to create the new ERI website
Contents
Creating News Items and a News List
- Drupal does not have existing news content type
- Need a content type for Date and PI
- Some tutorials
- use View to format blocks and pages
The steps I followed:
- Create a content type of 'news'
- Login as Site Admin
- Go to Structure/Content Types, click "Add content type"
- Name: News, Type: news (try to use all lower-case for the type), Description: News articles submitted by administrative students
- Workflow setting: Check 'Published', Disable 'Comments'
- Save the content type
- Add custom fields
- click on 'Manage Fields'
- Add in specific field labels and names for 'News', in this case, I created 3 custom field types: Date, PI, URL
- You can set the size of the text field and whether it is required or not
- Add some news
- click on 'Create Content' link and create some news items
- Create the default view in the VIew module
- go to Adminster/Siting building/Views
- click add to create a new View
- View name: News_list, View description: listing of recent news, View tag: News, View type: Node, Click Next
- Click on the '+' sign next to Fields. Scroll down and select Content: Date, Node: Title, Content: PI and click on the add button.
- For Content:Date, select Widget label (Date), and leave the rest to default
- For Node:Title, remove the label of 'Title' (clear the text). Check the box 'Output this field as a link' and check 'Link this field to its node'
- For Content: PI, select Widget label (Date), and leave the rest to default
- Click the '+' sign next to Filters. Check Node: Published and Node: Type. These options let us choose to display only Published content (Node: Published=Y) and only news (Node: Type='news') then click add
- For Node:Published, click 'yes' for published item
- For Node:Type, select 'Is one of' and check 'News'
- Now let's sort the news items by most recent first (descending order) Click on the '+' sign next to Sort criteria
- Check Content:Date and click add
- Select descending and click update
- Create the page view in the View module
- Select page under the Defaults and click Add Display
- In the Basic setting, change the Name to news_page, Title; Recent News, Style: Table, Item to display: Unlimited (type 0)
- Then check sortable for Fields: Date, Title, PI and select the Default sort to be Date
- Check 'Override normal sorting if click sorting is used' and select Default sort order to be Descending
- In the Page setting, make the changes to 'Path: news' and 'Menu: Normal: news' and select Menu to be Primary Links
- Click update and save
- Create a block for the most recent 5 news to display on the homepage
- Select block under the Defaults and click Add Display
- In the Basic setting, changethe Name to news_block, Title; Recent News, Style: Table, Item to display: 5, More Link: Yes
- click update and save
- Go to Site Building/Block,
- Scroll down to the list of inactive blocks and find the one named ‘news_list: news_block’. This is what we created when we built our view in the previous steps. Click on the dropdown box and select ‘content bottom’ (depending on where you want to place the block).
- Click on configure for 'news_list: news_block'. Scroll down to ‘Page specific visibility settings’ and click on ‘Show on only the listed pages’ and type <front> in the text box.
- Click the ‘Save blocks’ button at the bottom of the page.
Panel issues
- inserted images did not show up
- fix - need to select "Full Html" rather than "Filtered Html" in "Input Format"
Custom fields of content type issue
- the custom fields of a content type did not show up when I tried to create a new content of this content type
- fix - need to enable permissions of these fields in the User Management-Permissions
Change the layout of the node display page
- Suppose you want to display data, PI and URL on top of a new node rather than the bottom, how can you achieve that?
- A simple way - just to go Content management/Content types/ and click on manage fields on the content type of the nodes you want to change layout, click on the cross symbol next to the fields that you want to change orders and drag them to their new order of display locations. However, this will not only change the fields' view order, but also the fields' input order.
Making fields such as URL clickable
- The trick here is to select the right format for the field. Go to Content management/Content types/Manage Fields/Configure. For make URL clickable, you need to select the Widget type of the field to be 'Text Area (Multiple rows)' rather than just 'Text field'. Then , you need to select 'Text processing:' to be 'Filtered text (user selects input format)'. Now when you paste an URL in the field location, Drupal will automatically convert the link to clickable.
In View module, Link field contents to clickable URL
- This solved the issue of making the title of the articles in the news linked to the URL of the news source
- In the fields section under the View module, add Content: URL ( or whatever you need to link to ) and make sure it is on top of the field that you are trying to change its link path to. You can select 'Exclude from display' for the 'Content: URL' not to show up. Then, click on the field that you want to change its link path to the 'Content: URL' and check 'Output this field as a link' and make sure 'Link this field to its node' is not checked. In the Link Path, copy and paste the associated Drupal path of 'Content: URL', for example, [field_news_url_value]. You can find the translation in the 'Replacement Patterns'. Click update then save and you should see the field you selected is linked to the address of the URL field.