Week 9
Views - Advanced
We learned about making simple views: simple lists, grids or tables.
These use either fields or content.
We learned how to create page views and block views, and how they are used.
Small things views can do for you.
Change the markup of your fields.
You can manipulate the field results.
What should the field display if it has no value?
Add some custom html or text, or show fields through tokens.
Add simple filters.
An example
Let's create a new View to display all of our cars.
We will create a Page view to display all of our cars in Teaser form on the url /cars
Let's create a new View to display all of our cars.
We will create a Page view to display all of our cars in Teaser form on the url /cars
Let's create a new View to display all of our cars.
We will create a Page view to display all of our cars in Teaser form on the url /cars
Let's create a new View to display all of our cars.
We will create a Page view to display all of our cars in Teaser form on the url /cars
Let's create a new View to display all of our cars.
We will create a Page view to display all of our cars in Teaser form on the url /cars
Let's create a new View to display all of our cars.
We will create a Page view to display all of our cars in Teaser form on the url /cars
Add some filters to the car view:
Create views that show related content.
Filter criteria allow us to add filters that the user can manipulate, to narrow the view to only show a specific set of results.
Contextual filters are always applied. They are used to populate a view with content that is related.
Examples:
Lets create a view that shows articles using the same tags: Related articles
Create a related cars view, that shows 4 cars that are similar in options to the selected car.
Show this view on pages that are of the content type car.
Include more referenced content.
When you first create a view you select the base table from options such as Comments, Content, and Taxonomy terms. This cannot be changed later. After that selection you will only be able to select fields from that base table.
For example, with a Content view, you can get the User ID of the author, but not the author's username.
To get that information you will need to create a Relationship to join those two tables. With the connection of User ID, you can get the author's username from the User table.