In this exercise we’ll customise the Employment news View page we created earlier, making it show three items of recent content, then a bulleted list of titles of seven more jobs. Below is what the layout of the page will look like.
Showing 3 jobs, the more jobs
There are seven stages in this process:
- Locate the View
- Change the number of items to display
- Add a new display: an attached list
- Add a header to the attachment
- Change the offset to exclude the first three articles
- Change the attachment setting
- Review your changes
-
Navigate to the admin/structure/views and edit the Employment news view.\
Showing the edit button in the Views listing page
- Under Pager click "mini" to change the settings.
- Select "Display a specified number of items".
- Click Apply.
- Change Items per page: 3.
- Click Apply.
Now check your preview to confirm three items are displayed. Scroll down to the Preview section to check only three items are displayed.
\
Showing preview results
Next we'll add a list of seven more recent jobs to the bottom of this view.
-
At the top, click the +Add button and select "Attachment".
-
You’ll now have more than one display available, with the one you’re editing highlighted. Make sure the correct one is always highlighted when you’re editing views.
Highlighting the Attachment display tab
-
Next click Unformatted list under Format in the left column. A new window will pop up, giving you the option to select the display you're changing.\
Field settings
-
Select "This attachment".
-
Select "HTML list".
-
Click the Apply (this display) button.
-
The next screen is “Attachment: Style options”. Leave all settings as default and click the Apply button.
Attachment style settings
-
Under Format → Show, click Content to change the settings. Select the Fields radio button.
Attachment row style settings
-
Then click Apply on the final screen, leaving the settings as they are.
-
You'll see that Views added a Title field for us. If we needed more fields to be displayed, we could have added them using the Add button. Let’s continue with only the Title field for now.
Title field in View
-
Check the Preview pane at the bottom of the page to confirm our display is correct.
-
Under the Header section on the View page click Add.
-
Make sure you’re editing "This attachment (override)".
-
Search for and select "Text area". Apply changes.
-
Make sure the Text format for the Content field is Rich Text. Then type in the Content field: <p>More Jobs</p>
Adding content to global text area
-
Apply the changes.
-
Check that the preview shows text ‘More Jobs’ above the list.\
Preview of new header
Our Attachment view will be displayed below the first three Jobs, so we need to exclude those from our list to avoid displaying duplicate content:
-
Make sure you're still editing the Attachment display. Under the Pager settings in the centre column, click "10 items" to change the setting.
-
Change the “Items to display” to 7 and the "Offset" to 3. Apply the changes.
\Pager options settings