Webinar

How to Create Single-Page Apps With Drupal

Undefined

How to Create Single-Page Apps With Drupal

The days of the static web page are over. Using Drupal, a web page can behave more like a desktop application. In this webinar, we'll walk through the technical details of using Drupal to dynamically provide content to a single-page application.

Views Mini-Course, Part III: How to Back Up Your Views Safely

Undefined

Views Mini-Course, Part III: How to Back Up Your Views Safely

In part three of our mini-course on Views, Heather James, training manager at Acquia, will show you how to make your Views easier to manage and backup. She’ll show you how to export your Views to code. Editing Views on a live site is dangerous. Using the techniques you'll learn in this class, you'll be able to backup your Views settings safely. If you've never built a module before, this is a great way to start.

In this webinar, Heather will demonstrate:

Best Practice Checklist for Building a Drupal Website

Undefined

Best Practice Checklist for Building a Drupal Website

Before you launch a Drupal site, how do you make sure that you haven't missed anything and that your site is ready to launch? If someone else is going to be maintaining the site, how do you make sure the site can be easily maintained? While Drupal provides lots of functionality out-of-the box, even the simplest website requires configuration, installing contributed modules, and the checking of checkboxes.

Tips and Tricks for Getting the Most Out of Views

Undefined

Tips and Tricks for Getting the Most Out of Views

Views is the most popular contributed module on Drupal.org and an essential tool for any Drupal website. It allows you to create dynamic listings of content with just a few clicks of the mouse. This webinar will give you an overview of essential Views concepts and give you a taste for what this powerful module can do.

We'll cover:

Click to see video transcript


Female: Today’s webinar is Tips and Tricks for Getting the Most Out of Views, with guest speaker is Suzanne Kennedy, who is the co-founder and front-end lead at Evolving Web. We’re very excited to have Suzanne on the call today, and I’m Hannah Corey and I’m a marketing specialist here at Acquia.

Suzanne Kennedy: Hi, My name is Suzanne Kennedy and I’m going to be presenting today on Views. We’ll be covering some tips and tricks on how to you use Views. I’m assuming a lot of you already have a lot of knowledge about Drupal and want to learn more about how to build more effective websites in Drupal. Just trying to get to my first slide here.

Okay, so as Hannah mentioned my name is Suzanne Kennedy. I worked at Evolving Web and my role at Evolving Web is as a trainer and also a themer and site builder. I do a lot of the work taking care of the front-end of the Drupal sites that we build.

I’m just going to do a quick introduction to Views. If you’re already familiar with Views, this will be kind of a recap but I just want us to go over some of the key concepts. When you start off with a Drupal site and you’re using Drupal core, you have a lot of content management features taken care for you. So you already have content in your site and then you can have users and a set of taxonomy terms and things like comments, and that gives you a lot of individual pieces of content. So the role of Views in a Drupal site is really bring all that content together and organize it on your site so that might in the form of lists of content that you would find in different places on your site. So if you go to a certain page, you might see a list of articles.

A View consists of a lot configuration but the most key pieces of configuration are the fields that show up in your Views so the actual content that gets displayed and then also, you can also sort and filter what content your displaying. So you can select only to display certain types of content in your list and you can choose to sort that content in a certain way.

The basics of configuring the View consist of a bunch of steps but for any of View, it’ll consist of choosing what you want to list. So what type of content you want to pull out of the database whether it is pieces of content like nodes, users, taxonomy terms and then you can add filters and sorts to that. So you can say, “Okay, I want to show certain types of content. I want to show articles or I want to show job postings.”

Then you can choose a format so you can decide how you want all of that content to be formatted. There are bunch of different options out of the box but the most common ones are unformatted content, which gives you a list of DIVs, a list - an HTML list with ULs and Lis - and then a table, so a basic HTML table. Then the other thing you have to choose is how you want your View to be displayed. So do you want it to display when you go to a certain URL, as the main content of a page or do you want it to show up in a block.

So the first step what to list. It’s really important when you’re in the process of making a View, it’s really important to know what you want to pull out of the database.

Adding filters and sorts. This is important because obviously showing all the content on your site is not going to be so useful to your users. You’re probably going to want to add at least some kind of filtering. Often people filter by content type if you are displaying nodes. You also probably want to make sure you’re only showing published content to your users. Then it’s also important to think about how you want to sort the content. So common sorts are things like the date the content was posted or the titles if you want to show things in alphabetical order.

There are a lot of options for how you want to format your content in Views. As I mentioned there are some built-in options but you can also extend the list of options. So I’ll be talking about today about some modules you can add to Drupal to give you more options for how you format your Views. Things like calendars and maps are other ways you can display your list of content.

One of the things you want to think about right off the bat with Views is how you want to display your list. The two main options for displays in Views are page displays and block displays, but there’s other options as well. So you can display a View as an RSS Feed and attach that to a page display. You can also create attachment displays which you can add to other Views. So displays are really important when you’re working on building a View.

To just give you an idea of the anatomy of a View, what it consist of. Most Views have a title, you can add a header which is some text that goes above the list of results and then each item in the View is called a row. The whole set of rows are often called results and at the bottom, you may have pager which lets you go to subsequent pages of results if there’s too many to fit one page.

So if you’re looking at a real live View, it might look something like this. Like a list of articles and then each row consists of either a teaser or some fields.

So the role of Views in Drupal is really as a query builder. It’s a way of telling Drupal what content you want to pull out of the database and rather than having to write sequel of statements and custom code to pull out exactly what you want, Views provides a user interface for doing pretty much the same thing.

So selecting what content you want to display and then configuring exactly how that’s going to show up on the site.

The Views Editor looks like something like this. I’m sure its familiar to a lot of you and in the presentation today, I’ll be pointing out certain parts of it that you might be less familiar with. So really the goal of this presentation is to give you some insight in to what Views can do. I’ll be showing you a lot of examples and then I’ll also be pointing to places in the configuration that you might not know about even if you are familiar with Views like check boxes that can save you a lot of time and frustration and I’ll be talking about a bunch of modules you can use to extend Views functionality.

The first thing I’m going to be talking about is how to change the markup of your View. So how to change how the content is formatted and exactly what markup is used around the fields that make up your View.

So as I mentioned there’s a lot of format options to choose from in Views and it’s important to choose the right format.

So the built-in format is listed here and the unformatted list is kind of the default that people go for but you might want to explore using some of the other ones.

So for example, if you are showing a lot of visual data, it’s ideal to use the grid format which you can use to make a table but it’s to display non-tabular data. So often content is more visual, if you have a lot of images that you want to show in a grid. It’s often used for displaying grids that show the users on your site.

Another option is HTML tables. So if you have a lot of content and you want to make it easier for users to scan the content, displaying your list as a table rather than an HTML list can be a good choice.

Another thing to think about when you’re working for a markup for your View is whether to display your list as a set of fields or as part of content.

So this is a terminology that can be a little bit particular to Views but there’s a setting in Views called the ‘rows style setting’ and this lets you switch between showing fields and showing things like teasers. So do you want to have fine-grain control over your View and be able to manipulate how each field is displayed or do you want to leave that up to the settings that you already have for View modes on your site so things like teasers.

So that option looks something like this, choosing between fields and content. With fields, you get to control exactly which fields are showing up, what order they’re showing up, and you can change the markup for each field. Whereas if you choose content then you’ll be selecting a View mode on your site so the common View modes that you would be using will be things like Teaser and the Full Node but you can add other View modes to your site as well. The advantage going with fields is that you get a lot more control over how the fields are displayed. The advantage of going with the View mode, is that you can create a teaser that really looks great for your content and then you can reuse that on multiple Views so you don’t have to re-configure it every time. So if you do go with fields, you get a lot more options. I’ll be showing you some of the other things you can do if you display fields in your View.

So one thing you can do if you’re displaying fields in your Views is that you can change the markup for each field right in the configuration. So if you have a list of articles that’s what you are showing in your View and you want the title of each article to be an H3 tag instead of span or a DIV then you can change that right in the View’s Configuration.

So when your configuring your View, you can go into the style settings and the configuration, and you can actually use exactly which HTML tag is used to wrap that field. So you don’t need to be a themer and make a custom template to make this change, you can do it right in the Views Configuration. This can be really useful if you have specific requirements for search engine optimization or if you’re trying to follow a certain standard in terms of the markup in your site.

Another thing you can do with field is you can combine multiple fields together in the same HTML markup. So if you have two fields that you want to show and you want to show them next to each other, or if you want to combine them somehow then you can actually exclude a field and add it later as part of the second field.

So for every field in the configuration, there’s a check box to exclude it from the display and then there’s another setting for each field to rewrite the results so you can add some text to the field before it’s printed out or you can actually use tokens to combine multiple fields together.

Another thing you can take advantage of when you’re displaying fields in your View is using field formatter. So you are probably familiar with field formatters when you configure content types in Drupal. You can select exactly how the field is displayed using the field formatters that the field type provides. So for example, if you’re using a link field, you’re using a link module for example, you’ll have an option to display the link as a link or as a text, a linked text. So there are different field formatters available depending on which fields you’re using.

So for example, if you’re looking at a mockup of site and it looks something like this, you’ll notice that there are social media links in there that are styled in a certain way and then you have dates listed for each result and those have a certain format as well. So being able to choose exactly how these fields are formatted is really important.

Another example of needing to format fields is if you’re displaying media in your View. So if you’re showing a View that lists a lot of videos or audio content then you want to have some way of formatting the audio file or the video file as an actual player like a video player or an audio player.

So in the field configuration, you can select which formatter you want to use and a lot of the formatters have settings as well. So you can choose to display your images as actual images and then you can choose the size to use for those images. Or in the case of the date that we saw in the examples, you’d be able to choose what date format to use.

So those options are all for how to have more control over the format interviewer field in Views but the other option is to use View modes. So the built-in View mode that you’re mostly to use in a View would be a teaser. You can control the display of the teaser through the content type configuration and then you just take advantage of that in your View and use the configuration that’s already been done on the content type UI. If you need to display your content in more than one way on your site, you might consider using View modes, and you can set up custom View modes using the display suite module.

If you want to display content in different ways on different parts of your site but you want to reuse that configuration across Views then this is really a great technique to use for that. So to take advantage of this, you have to set up your View modes using Display Suite and then choose to display the content of your site as content rather than fields. Then in the settings for that, you can choose exactly what View mode to use. So you can switch between teaser, full content and then in this case, I’ve set up a custom-made View called mini-teaser that I can use to display my content.

Another great feature of Views which is really useful is being able to add multiple displays. So you’re likely to be displaying content throughout your site in different places and you want to be listing that content in different ways depending on the context.

So for example, I may have a View that shows articles and I want to display them on an articles page but I also want to display them on the homepage on a block and maybe I want to display them on another page at the bottom of the content. So I have three contexts that I have the same View that I want to use. I want to be displaying the same content. I just want to be varying it slightly on depending on where it is showing up in the site.

You can accomplish this using multiple displays and just creating a single View. So let’s say I make an article view, I can have a display of those articles on a page and then I’m going to be associating about a path for that page but then I can also set up a couple of blocks. So I could be displaying the same content in three different ways using the same View. So in the Views UI, there’s a bar at the top that shows you all the displays you have and you can add more displays that way. Now, once you set up multiple displays there’s probably going to be some variation between them. So maybe in one display you’ll be showing certain fields and then in another display, you’ll be adding a couple of extra fields.

So Views lets you override any of the settings you have in your View or many of the settings you have in your View depending on the display. So whenever you’re choosing a setting or changing a setting you can choose whether you’re changing the setting for all the displays in your View or just the display that you’re looking at currently. So this is a way to build in to reuse the Views logic or the Views configuration that you have built across your displays but still allow for flexibility. So it still allows you to change some of the settings depending on the display.

So talking about displays, pages and blocks are the most common displays that you’ll be using but there are other displays that you can use as well and one of those is the attachment display.

Attachment displays basically let you combine multiple Views together. So let’s say I have one list of articles and then I have another display that shows articles but I actually want show one of those lists above the other. I can use an attachment display and it will let me attach one View to another display of the same View. This is really useful if you have a list of content and you want to show a featured item at the top of the list. You’ll see this a lot on new sites but I’ve seen it many different other types of sites as well. How you do this with the attachment is if you create a list of your articles say a page display and then you create an attachment display that had a slightly different configuration.

So in this case, just like I’m showing on this slide, the first one has larger image so you change the formatting of that image in the attachment and then you attach the attachment to the page display at the top.

Here’s another example on the right of the slide from the Economist.com website. The first result in the View is meant to have an image whereas the rest of the results don’t. So it’s really easy to create an attachment display and then there’s a setting to add the attachment before or after one of the other displays in your View.

Another thing that you might want to do to vary the markup in your View is to create a grouping of results to make it easier to scan results or for users to see what’s going in terms of the organization of content in your View.

So a grouping of results might look something this where you have a view that list a whole bunch of items and then you have subheadings in your View that grouped together similar items and the subheading is based on one of the fields in your View.

So in this example is a news archive and then I’m grouping the results, I’m grouping the news items based on the month in which they were published. So you can accomplish this in Views really easily by adding a field for the item you want to group by. So in this case, I’d add a field for the month in which the news was published and there’s a setting to group by any of the fields that you’ve added to your View.

So when you’re configuring the format settings for your View, there’s a grouping field setting. So you can choose to group by any of the fields you’ve added to your View. This can make it a lot easier to organize your View and organize content to make it easier for people to find what they’re looking for.

Another thing you can do with Views is create RSS feeds. So a feed is actually one of the display types and you can attach a feed display to page display. So really easy to set up RSS feeds on your site using Views.

One thing that’s really common on sites, is to have a block display that links to a page display. So you might have a list of recent news items on the homepage but you want to give users a link to a full page of results and you can do this by adding a block display and a page display on the same view.

So for example, you might have a list of upcoming courses and then you have a CL link that would link to a page of upcoming courses.

In the View Configuration, if you add a block display, there’s a link display setting which lets you choose which page you link more links to. So if you have multiple blocks and multiple pages in your single View, you can configure exactly which blocks link to which pages.

Now I’m going to move on to talk about Views configuration for filtering and sorting so ways of making your site more dynamic in terms of how your content is filtered and then also how it gets sorted and how users can interact with that on your site.

I mentioned earlier some really basic filters and sorts so filtering by content type, sorting by post date. These are things you’ll see quite a bit.

How filters and sorts work in Drupal is that you add something to filter or sort by. So you’re adding a filter criteria, for example, the published status of your content, and then you can configure that filter or that sort. So you can decide “Okay, do I want to show content that is published or content that isn’t published?” So it’s always a two-step process adding filters and sorts.

So one thing you can do that can be really useful for your content is filtering content by whether a certain field exists or not.

So let’s say you’re displaying a list of your users and this is very visual content because you want to show a profile image of each of your users; but you don’t want to show users that don’t have an image because then it kind of takes away from the visual impact of the View. You have all these placeholder user images. So one thing you can do is you can filter by whether or not a certain field exists.

So I can add filter criteria for the user image on the site and then I can configure the setting so that the result will only show if that field exist. So if user has an avatar then I’ll show the result for that user.

Another thing you can do with filters is you can expose filters to your users to let them filter the content. So rather than doing the two-step process where you add a filter and choose exactly how it’s configured, you leave that second step up to your users and give them a form where they can have some control over the view.

So for example on this site, there is a list of projects and you can search for the projects based on cities or based on states, and that configuration is left up to the users. So they can enter in whatever they want and then click apply to filter down the results. So rather than the site builder deciding exactly how the content is going to be organized, it’s left up to the user to go in and filter and find what they’re looking for.

In this example, the exposed filters are little bit more visual so they’ve been themed to look a little bit more attractive. It’s the same idea. It’s a page where you can find the project and you can filter down based on the taxonomy terms listed in the exposed filter.

So exposing a filter is really easy. In the configuration settings for the filter, there’s a check box ‘expose this filter to visitors’ to allow them to change it. So you just check that off and then you have a bit of configuration around the label for the form element that you’re setting out.

There are some modules you can use to extend exposed filters. So exposed filters are built-in to Views but there’s module called ‘better exposed filters’ which gives you some more options. Then there’s also a module called ‘views dependent filter’ and that lets you set up exposed filters that have dependencies. So maybe you’d filter by content type first and then you would have another filter that opened up depending on which content type you had selected in the first field.

So when you looked at exposed filters, they start to look a lot like search, right. You are kind of building a search UI and you can actually add an exposed filter that’s basically for search.

It’s a keyword exposed filter that you can add to your View. How you do this is you add a filter criteria for a search term and then you can configure ‘expose this filter to visitors’ like you do for any other filter that you’re adding and that effectively becomes a search field. Now, you have to have core search enabled for this to work, but as long as you have that then you can build simple search UI using Views.

So another thing you can do in terms of making your Views interactive is you can expose sorts to your users. So exposing filters is really common, exposing sorts maybe isn’t quite as common but you see it sometimes on sites that have more tabular data.

So if you’re displaying a list of content in a table and you have a heading at the top of the table listing of all the column headings, sometimes you’ll see an arrow up the top there, next to the heading and that’s a way to expose the sort to the user. So they can control how the sort is being applied. So for example, in this view the content is being sorted by when it was last updated and you can choose whether that’s an ascending sort or a descending sort. So whether it’s showing most recent changes first or the ones that are furthest in the past.

Exposing sorts is just like exposing filters, it is just a check box when you’re configuring a sort.

If you’re showing content on your site that is really date specific like you’re showing a list of events, then you should consider using the date views module to give you more flexibility in terms of how you filter and sort your results. For example, if you want to show an upcoming events View, and you want to show only the events that are taking place in the future, you can use the Date Views module to show only content where the date associated with the content is in the future.

So Date Views is part of the Date Module so it’s an extra contributed module you will have to add, and you’ll be adding it anyway if you’re creating event content on your site. Once you’ve set that up, you can add a filter based on date, and you can control exactly what content is being displayed. So like I said future content is one use case but you might have others and there’s a lot of options and flexibility there with how you filter your content by date.

So those were all the ideas about how to add more filtering and sorting to your views and now I’m going to talk about adding contextual filters and relationships. So this is kind of going the next step, getting a bit more advanced so if you haven’t been using Views for very long or you’re brand new to Views, this is just kind of a more advanced topic. Contextual filters and relationships really are what start to make your Views very powerful in terms of displaying dynamic content throughout your site and a lot of Drupal site building is dependent on these two features of Views.

So first of all contextual filters, contextual filters are a way of displaying content that gets filtered in a dynamic way. S=So rather than always filtering content the same way, the filter is dependent on where you are on your site. So if you’re looking at a certain page, one filter will be applied but if you go to a different page then the filter changes. An example of this would be a page display where you’re filtering by taxonomy terms and based on the path of the page, the taxonomy term changes. So if you go to one taxonomy term page, you’ll see content about that term but if you go to a different page, you’ll see content about the other term. There’s a built-in taxonomy term View in Drupal. You can look at that and see how that works. You just have to enable the view on your site when you install Views.

So for example if I go to a page on my website evolvingweb.ca/category/tags/Drupal – how is the content of this page being filtered? Well, /category/tags/Drupal is actually an alias because I have Pathauto on my site, as most Drupal sites do. So the actual Drupal system tasked for this page is taxonomy/term/1 and the ‘1’ part is the argument or where the contextual filter comes in to place. So my Views configuration, I don’t have a View with a path of taxonomy/term/1. In Views, it’s taxonomy/term/% and that percent sign is a placeholder for my contextual filter and the one is just the taxonomy term ID. If I want to display this page of results rather than coming up with a separate view for every taxonomy term on my site, I can make a single View that’s dynamic. That filters the content dynamically.

In the Views Configuration, it looks something like this. There’s an advanced column in the Views UI on the right, if you expand that, you’ll see where you can add a contextual filter. So I’m adding a contextual filter for a taxonomy term because that’s what I want to filter by and then I can configure it to say I want to make sure it’s a taxonomy term and then I can configure it on the second part of that interface. So that’s for pages, contextual filters where there is an argument that’s being passed through the URL to the page, and then being used to filter the content in the Views Configuration.

The other place where we see contextual filters come into play is in blocks and so I’ll give another example. Let’s say I have a lot of nodes on my site and I want to show the tags associated with the node in the sidebar rather than as part of the node content. So I have a website with some content in the main content area but then I want to break out some of that content and put it on a block somewhere else on the page maybe on a sidebar. Again, contextual filters, I want to be filtering based on the node that I’m looking at on this page but that’s going to change based on which node I’m looking at. In the block on the sidebar, the tags for the Node 1 Block in my diagram that’s going to be a View. So I’m going to use a View to display one of the fields for my content but that view is going to be dependent on which node I’m looking at. So again we’ll talk about the URL of the page that I’m looking at. It’s evolvingweb.ca/content/blogposttitle but that’s an alias, right. So the actual Drupal path is node/1 and I can use that URL, the node/1, to get the node ID, in this case it’s 1, and I can show the tags just for node 1. So I can still filter the content in my View so I’m only showing the content associated with the node that I’m looking at. So in the configuration, again, you’re adding the contextual filter and I’m adding the node ideas to contextual filters because that’s how I’m going to tell which node that I’m going to look at. Then in the configuration, you can choose to take the node ID from the URL. There’s a setting ‘provide default value for my contextual filter’ and one of the options is ‘content ID from a URL.’

So that’s just a quick overview of contextual filters and I’ll be talking about some of the use cases for that. So the user interface can sometimes be a little bit confusing at first to wrap your head around but I just want to give you an overview of some of the places where you can use this functionality on your site.

So one really useful thing you can do with contextual filters is to show related content or break up your content and show it in different places. Often in Drupal we kind of think of being confined to the node content area when we’re creating sites and so contextual filters lets you kind of break out of that and add Views in your sidebars or in other regions on your site relating that back to the actual content of the page that you’re looking at.

For example, if I want to show a field in a separate block, I can do that by adding a view to show that field and then using a contextual filter to relate the view to the node that I’m looking at.

Another example would be if you had a field that showed related content and then using a contextual filter to only show the field for the current node.

Another thing you can do with contextual filters is use it to exclude results. So the example, we just looked at was for only showing results for the current content but you can kind of do the opposite. You can say, “Okay, show me a list of the contents except for the piece of content that I’m looking at.”

The use case for case for this would be something like you’re looking at a piece of news or an article on your site and then in the sidebar you have a list of other news items or other articles, but you want to exclude the article that the user is currently looking at because of course they don’t need a link to that in the sidebar, they’re already there. So if you want to create this “More News” block or “Other News” you can actually exclude that current node from the results using contextual filters.

So how you do this, you set up the contextual filters like what we saw before. You add the contextual filter for the node ID and then you set that up to use the node ID from the URL. Then the settings for the contextual filter at the bottom, there’s this ‘More’ section which is extremely useful and it has a check box for ‘exclude’, which just lets you exclude the current item.

So the next thing I’m going to talk about is how to extend Views. So pretty much everything we’ve talked about up and until now has been part of the Views module, but there’s a lot of modules you can add to extend Views functionality so to add extra functionality for your Views.

One thing that’s incredibly useful in our Drupal site is to set up some Views for your administrators because often Drupal sites have a lot of content and it can be really useful for administrators to have Views just for browsing through that content and you can edit and manage the content of site.

The administrative Views module replaces the default content administration pages. So the default content administration in Drupal is a little bit clunky, it’s kind of hard to add filters and you can’t customize it. So administrative views add a View just to replace that page and it sets it all up for you so you don’t have to do any configuration if you don’t have time at the end of the project but you can go in and configure that and add more settings.

Another module you can use for your administrators is draggable Views and it’s a module that adds a field to your Views or allows you to add a field of Views, but associates an order with the Views results. So this is really useful if you have content that needs to be displayed in a very particular order, but the order is arbitrary so it’s not based on a certain criteria that already exist but you want your administrators to be able to display the results in whatever order they want. So for example, on a slide show on your site, you might want to let the administrator choose exactly which order the slides appear.

So draggable views allows you set up a display which an administrator can use to reorder the Views. So it gets you a drag and drop UI for changing the order of the results and then that ordering is going to impact the actual display that the users are going to see on the site. So it’s an extra display that you’re adding to your Views and then you’re given that UI to administrators to change the ordering of the results.

Another really important module for administrative views is view bulk operations and that sets up a UI where administrators can select multiple pieces of content and then do operations on them. So delete a whole bunch of content or publish it or change the status somehow and so if you set up a table view for your administrators and you have ‘views bulk operations’ enabled on your sites then you can add ‘use View bulk operation’ field which gives you a check box for each of the items in the View’s results. Then at the top there’ll be a form where you can actually do the operation on your content.

Another really powerful thing that you can do with the View is you can combine it with the Apache Solr module, which gives you search results which you can configure using the Views UI.

So basically, your search page will be powered by Apache Solr but you can change the configuration of the results and everything using the Views user interface that you’re used to. So adding fields, changing the formatting, all of the functionality that I’ve been talking about, you can do that for all your search results. So it’s a really powerful combination.

You can use Views to display at lot more types of data. Pretty much today, I’ve been using nodes as an example but of course you can use Views to display things like users and taxonomy terms. If you’re adding other modules to your site that provide other entities or other types of content then you can use Views to organize that too.

Most modules come with Views integration so you’ll be able to control the organization of that content view as well. So things like if you are adding products or media to your site using the commerce module or the media, then you can use Views to control how that content is displayed.

If you have custom data that you’re adding using a custom module, you can add Views integration yourself and there’s a post up on our blog about how to integrate Views with your custom data.

I’ll just run through really quickly a couple of modules you can add to add extra formats to your Views. So if you don’t want to display your contents in a table or a list but you want to add something that’s a bit more dynamic, you can use Views Slideshow for example, to show a rotator on the homepage of your site so each item in the slideshow is a Views results.

Views Slideshow gives you configuration for the transitions in the slideshow and how the controls work for it to change to the next slide. So all of that is added to the Views Configuration when you add a Views Slideshow.

The Calendar Module is another example of using an extra module to format your Views in different ways.

The calendar module gives you templates that you can use to add - so you are adding a new View but you’re using a template. So rather than adding it from scratch it’s going to give you some of the configurations for displaying your content in a calendar right out of the box. The user interface for that looks something like this.

So you get a single calendar view and you’ll have a display for how you want that calendar to show up. So it could be a month’s display that would be the most common type of display but you could also show a week’s display or a day display or a year display, and then you can go in and customize that.

You can also use Views to display maps. So if you have location data in your content and you’re using something like the open layers module just to show maps on your site then you can use Open Layers Views to display a list of content with the list formatted as a map.

So obviously, there’s a lot of functionality that you can build that with Views and you’ll probably be spending a lot of time if you’re a site builder just working with this Views UI.

So just a couple of things, a couple of tips when you’re working with Views. First of all, when you are editing your View, there’s a preview at the bottom of the Views Configuration UI that you can use to see what your View’s going to look like before you publish it. So if you’re doing a lot of work, it can save you time.

You don’t have to save the Views every single time you want to see the changes. You can also export your Views after you spend several hours working on your View.

You probably want to make sure that your changes don’t get lost or blown away. So you can export Views just in the built-in Views user interface. If you’re using the features module, which I highly recommend then you can add your Views to feature which effectively exports your Views into code and that way you can add them to version control and not worry about losing all of your changes.

If you’re a themer, and you’re not satisfied with all the markup that you can change through the configuration, there is a way to easily theme your Views results and the Views module comes with a theme information page or a link in the interface for your Views display. That’s going to show you exactly which templates you are using and help you overwrite those using your own custom templates and themes.

So lots of ways to plug into to Views and do custom theming with Views content.

I know I covered a lot of different topics today and hopefully I gave you a sense of what you can do with Views and a bit of an idea of how to do some of that configuration. If you want more information, I’m doing some upcoming Views trainings, one in Ottawa on May 13th and then also at DrupalCon Portland on May 20th. I think there’s one spot left in that class at Portland. So if you really want to learn more about Views then you can sign up today and get the last ticket. So I guess we might have a little bit of time for questions? Hannah, if you…

Female: Yes, thank you, Suzanne. We had a couple come in so we can answer those and then I think we can wrap up. So the first question that came in is there a way to convert a Views page to a Views block and vice-versa through the UI?

Suzanne Kennedy: No, there isn’t. You can clone - You can clone a display in Views. So if you have an existing block display or page display then you can clone that but it will still be a page display or block display and that’s because there’s certain settings associated with the fact that it’s a page or a block like the path for pages and then for blocks whether it’s link to a page.

Female: Great. We had one more question come in, if you have visual data and we choose the grid display, table format, how can that be responsive?

Suzanne Kennedy: That’s a really good question. So usually it’s pretty hard to make tables responsive. So I’ve seen people do different thing with grid displays basically changing it so that when you reduced it in size, it collapses down into single column displaying all the results just in one column rather than having multiple columns like you’d normally have a for a table. So for example if you go to the DrupalCon Portland website, on the attendees page there is a grid display and you can collapse that down and see how that behaves but that’s what that View does.

Female: Okay. We have one last question. How do you display data in charts and graphs?

Suzanne Kennedy: Okay. Another good question. So charts and graphs similar to things like maps and slideshows, it’s kind of different way of formatting the data. So you’d want to look into some of the modules out there for Drupal that give you charts and graphs functionality. I can’t think of the names off the top of my head but basically you’re looking for modules with Views Integration that let you add charts and graphs. Then that would be another formatting option. So if you click on format then you’d be selecting the option to use that module’s formatting through interface that way.

Female: Great. Thank you so much, Suzanne. Thank you everyone for attending. Again, the slides and recording of this webinar will be posted to the Acquia.com website and we’ll also email you out a copy. Thank you, Suzanne, so much for your great presentation and answering those questions. Do you want to end with anything?

Suzanne Kennedy: No, I guess just thanks everyone for coming. I know it was a lot of information but I’m sure if you look over the slides, you’ll get a better idea of where to look in the UI and best of luck with Views configuration.

Female: Thanks so much.

Suzanne Kennedy: Thanks.

Views Mini-Course, Part I: An Introduction to Views

Undefined

Views Mini-Course, Part I: An Introduction to Views

Even if you're brand new to Drupal, find out what the Views module can do. Heather James, manager of training here at Acquia, will show you around the interface so you can become familiar with key terminology for Views such as displays, formats, filters. She’ll also demo how to create a view of content, users or taxonomy. She’ll give you a peek at how to extend Views with other modules.

You will learn about:

Click to see video transcript

Moderator: Views Mini-Course Part 1 – An Introduction to Views with Heather James who is the manager of training here at Acquia. We are very excited to have Heather on the line.

Heather James: …the training program at Acquia was established in 2010 and just last year, we trained over 3,000 people, so we get a lot of people in the door who are brand new to Drupal. We maintain our own course materials so they’re continuously updated, and that keeps us pretty busy.

The training is actually run by our training partners and those folks are experienced developers and they actually enjoy getting away from behind the computer and helping other people, so you’d actually find the events are quite fun and you get a lot of insight into real-life kind of Drupal problems and solutions.

We have a lot of tailored courses available and I’m happy to talk with you at any time about setting up training for your team, so please contact me if you need some advice.

So you’ve landed on the very first class which is our first mini course, which is an introduction to Views, and we will have soon a Drupal for Project Managers mini-course that will be a four-part course coming in May. We put these together because we thought that there were still lots of people who – and even though there are a lot of free stuff out there, we wanted to contribute and make some more training available for you guys.

In this mini-course, you’re going to find out in these three weeks how to expose data across your site, create lists of content, users, and terms; and format it as tables, lists, galleries, slideshows; and that’s really what Views does. Today, we’re just going to start with the very basics. We’re going to start with just how Views works and what it does, and give you a general orientation and terminology of just so you’d kind of know enough basically to be dangerous, at least in the next week.

In order to get most out of today’s session, you’ll need to already understand how to add content to Drupal, how to customize content types, what modules are, and how to install and configure modules.

You might find yourself somewhere on this spectrum. I actually was sort of surprised that you might find people like this little orange dot here, someone who has actually got some experience with Drupal but really doesn’t know what Views is or is aware of Views but hasn’t actually felt them or made any use of them. I expected everyone to be like this blue dot. If you know Views and you’re experienced with Drupal, you probably know a lot about Views, but what I was surprised to find is on a lot of client sites where they’re building websites and not making any use of Views at all, and that’s why I wanted to run this mini-course.

We’re going to dig in now and first thing we’re going to do is address a kind of misconception, we could say. We’re really I guess brainwashed by this metaphor of manila folders and files and manila folders, and we sort of still think that way to the point when you’re even developing your own website, you may be thinking, “I’ve got a mental sitemap with pages and they fit in folders.” In fact, some or many actually - CMSs actually work this way so you may be familiar with other CMSs where you’d want to add a section on your site, so you add a folder and then you add in pages within that folder.

The problem is this isn’t just a mental hurdle. It also causes logistical problems if your CMS does work that way. Say for example, you want to add news headlines showing up in the sidebar of your contact page, so you’d have to what – maybe every time a news item was added, you’d have to copy the text, put a link, and update the contact page or update it all across the site wherever it appeared. Believe it or not, there’s a lot of people still even using Drupal that way and you don’t have to.

What we’re going to do right now is think of Drupal as holding data so not everything you’re going to see on our Drupal site is content per se but everything is data. Views is going to help us expose those data across the site, so you can think of these in different groups.

Now, I just thought it would be good if we got our hands dirty first of all. I’m going to do a very quick demo and kind of a magic trick and just show you how Views works. I promise I will go into it in much more detail afterwards.

The first thing we’re going to do is look at what Drupal does out of the box for listing content, and then we’ll see how we’re going to override that and we’ll see how to make a new view listing content type.

I’m going to bring you over to my Delicious Drupal site here. Here, I’m logged in as the User 1 or the Administrator so I see all the various controls available. Here’s a list of content on the site. We call this like the “river of content” which is okay. If I go over to Site Configuration, Site Information, I can see that I could change the amount of posts on the front page and I could even change the path, but that’s pretty much all I can do. The only other option I have is to go to Structure, Content Types. Say for example, with a specific content type like the fan art or cooking website, we don’t want recipes to show up on the front page. So I could change the default option that it doesn’t show up on the front page, and so I could limit that by all the various content types but still it’s quite limited in what I can do.

What I’d like to do on my Delicious Drupal Site is have a list of news items or news articles, so I’ll show you how to do that. Go to Structure, Views; of course, with the Views module enabled already. So we’ll go to Structure, Views, Add new view, and I would call it News Articles. Show in Content, so I mentioned before, we’ve got lots of different data here. We’re going to select Content in this case; of type, Article, so I’m limiting how much I’m going to show. I will create a page, here we go. I can even customize this path to make it shorter or change it any way I like. I’m going to keep the Default options. This is where you can see you can change your formatting and to keep it as Teasers, and that’s pretty much very similar to what’s on the front page and I can change the number of items to display.

I’m just going to save the options as we set them up in that wizard there, Save & Exit, and here we see a news page. Okay, fantastic. We’ve only got news articles now. We’re not getting everything else but if I go back to my home page, of course, it’s not set to my home page yet so I have to go back to Site Information and make my Default front page the news path that I just created.

Now, this is a little bit of magic hand-waving I’m doing right now. I am going through this a little bit quickly. I’m going to ask Hannah. If anyone has questions, Hannah can message me on Jabber and I’ll be able to see her questions if I’m going too quickly. I just want you to know that I will be covering this in more detail.

Here we go. We’ve created a view and it has got just the news. So hopefully at this stage now, what you know is that Views can allow you to basically limit your display of content. Let me go back to the presentation now. Now, there’s a potentially confusing problem. You may have realized that when we’re displaying content, we chose Teasers. Those are called View mode in Drupal and that has really nothing to do with Views, so another option which I’ll show you soon is to select Fields and then you can get field specific control.

At least at this stage, if what you understand so far about Views is that it’s a query builder, then we’re goaled in. We’re right where we need to be. We’re going to take a step back now and let me give you a little understanding of why we really have Views.

I love this website here. This is the Jane Pickens Theatre site. When we look at the front page – or the Coming Attractions Page, I should say – we may think, “Oh, okay. Well, we’re looking at a page of all of the content on this site and maybe this page is a piece of content where I can go in and edit the title of that coming attraction.” In terms of what Drupal thinks about this content, it’s only this piece here so we’re looking at one item of content or actually it’s called a node in Drupal, and that excludes anything in the sidebar, the header, the footer. This is just one entry in the content table as one piece of content. When we see something like a landing page like this, what you’re actually seeing is a collection of lots of different content from across the site. In the middle here, we see a slideshow so it’s just showing us things which have somehow been marked Featured, and then we’re seeing at the bottom, Coming Attractions like a gallery of movie posters and music posters.

This may be very different from how you’re thinking of how you approach developing your own sites if you’re new to Drupal. Now, perhaps your process and your workflow starts at Fireworks and you make your perfect markup and then you go to make your perfect markup and you got everything working just fine. Maybe in the old days, when you were doing database connections and combining HTML with your query results, you had to write this kind of messy code yourself. Things have gotten a bit better. We’ve got some great CMSs out there.

Here’s an example of ExpressionEngine which is like a tag-based templating system that has a query that we can actually alter and change. For example, say give us some information about the users. My question is what happens in the case that a client wants to change some of the logic or change what gets listed? They’re going to have to be calling you, right? I think it’s fine definitely if your business is keeping people’s websites updated and changing them, then you’re happy but if you work with a larger team of people, you may find that Views is going to be much easier to work with that will allow your colleagues to go and change the queries and update things or even create their own Views.

In fact, Views itself was actually developed at Sony by Earl Miles or merlinofchaos, and it has become so popular in fact that it has been included in Drupal 8. I don’t know if you can see the text here is quite small but one of the things that was found in Drupal 8 is that basic default front page was replaced with Views, so even that activity that I just showed you, replacing your front page with Views, is already included in Drupal 8.

So let’s say you’re brand new to Drupal and this happens a lot in a situation where you might want to create events. You probably would go directly to Drupal.org and you might be looking, for example, for a module that will allow you to have easy date selection, sidebar block showing like a little calendar or something like that, and you look for the event module. In Drupal 5 or 6, that’s exactly what you would’ve found but now with Drupal 7, we’re sort of pushing over into more generic and flexible solutions. So it’s actually a funny thing because you’ll actually be using less modules altogether. You have to use more modules to get the event – obviously, you use more modules to get this event functionality but once you have Views installed and the date modules, you can use them in lots of different ways.

You have a lot more control as well so instead of in the event module if you want to change, for example, how the data entry was, you have to write custom code yourself whereas with the date modules, you can create a field and control how the input is – if ever received I guess you could say. You can also have options for formatting how it displays so with Views, for example, you have the option of display formats or templates that create these calendars, the Full Calendar or the Calendar module. I hope that gives you a sense of really want makes Drupal a little bit different. I like to call this the “big fancy middle man” where Drupal allows you to control and configure display and layout. It makes it very different from other systems as you saw with ExpressionEngine or maybe WordPress.

At Acquia, we really believe that you’re going to get a better quality site that’s easier to maintain through more configuration, more site building, and less custom code. In fact, this just results from a survey done in 2011 of Drupal agency executives and they said that’s pretty much what they were looking at. It’s about 80% of their development project was done with site building and configuration and overall, that has less security risks, it’s easier to maintain, and I think you’re going to find it much easier to manage.

At this point, as long as you understand I guess that the CMS supposedly makes it easy, obviously, for a lay person to update content on the site without a developer, it’s Drupal taking it one step further and putting those developer tools within the reach of other people on your team. In fact, with the training we provide, we often find it’s a matter of change management because people have to change even the way they communicate within their development team so you may find that someone else in your team who is involved in user experience is able to now create a view and get involved in actually creating workable prototypes of your site.

We’re going to take a second to find your way around the Views. I just wanted to ask really quick - did anyone have any questions so far? I’m going to see. This is my first time actually doing the webinar so I’m sorry about any problems I’m having.

Moderator: We have one question come in. Will you be explaining one of the Views you’ve used versus one that’s not?

Heather James: That’s a really good question. Yes, definitely. I think that in general, you want to be using Views especially for listing content on your site. I’m sorry, I’m just getting a little dazzled by the interface here on WebEx. If you’re going to be listing content on your site or making any lists of any data on your site, you want to be using Views basically. There are situations where if you have a site with a large volume of content or large volume of comments, for example, you will probably want to export your queries and optimize them and make them a little bit more fine-tuned but other than that, Views would begin, would start as a really great prototyping tool, for example, so I hope that makes sense.

Moderator: We have one more come in.

Heather James: Sure.

Moderator: Everyone has events. Does everyone have to build event content types or views? Is there a best practice?

Heather James: Yes. Actually, I did an events webinar a few months ago and because something like events we’ve done so frequently, there are people sharing modules that extend what Views can do. For example, write your calendar display, there are some great modules that help you get control over that. In terms of events management though, it’s actually sometimes you may be wanting to handle commerce, so you might start with something like Drupal Commerce to handle the payment or registration, or you might be using another service such as Eventbrite which handles your registration externally, and there are modules for that as well. I hate to say it depends but let’s see. I think it does actually. I hope that helps. We can get you the link to the – or you can look on our site for the events webinar which I think could give you a sense of how to configure your own event content type.

I am going to dig right into the Views UI and help you find your way around. I did a little magic trick before and we used the Views Wizard. The Views Wizard shows up when you first create a view and it has got some very basic functionality available but like any good wizard, I want you to know that it does disappear and that’s extremely confusing for someone who’s new to Views. I’ve had this time and again. People go back to edit the view and they expect to be able to get back to this wizard. It won’t happen.

What you will see the next time you edit your view or continue on to Save & Edit view is the regular Views editor interface. Admittedly, there are a lot of options here so it can be a little dizzying, but we’re going to simplify the whole interface. If we just think about two questions, we’re first of all going to limit what we’re displaying so you’re going to focus on the sections of what you select and filter. Next, you’ll be thinking about how to format and display that so there’s a few sections I’m going to talk to you about to show you how you can get control over what it looks like.

Next week for the second session, we’re going to go into all of these in a lot more detail but just for right now, I just want to give you an overview. The first thing you’re doing is you saw me do when I created that articles list is you’re choosing your base table. If you already understand how databases work, you probably have a sense of, “Okay. I’m actually going to run a query on a specific set of data in my database.” Once you do that, you cannot change it later.

You can, however, use relationships to get data from another table and if this sounds like gobbledygook, I’ll give you an example. You may have a list of content and then you want to also show the author or maybe something about the author, maybe a picture or something like that. You can use relationship to get more information about some related data.

The next thing you’re going to do is somehow to filter a limit, so you don’t want to just cripple your site by listing all the content and everything. You’re going to either like limit by which author you have or maybe you want to limit by a specific content type. After you do that, you’re going to somehow select – you can select the View mode as I showed you before with like the teaser or you can select Fields. You’ll probably most likely be selecting Fields and you can even change and arrange how they layout.

The next thing you’ll do is select a format. So you’ve seen a lot of different formatting options here. You’ll notice I put in a map. That would actually be done with another module that will plot your coordinates, for example, on a map. There are some great tools. There’s not just these. There are slide shows and there’s a lot of great other modules you can try out and we’ll be talking about those as well next week.

I’d like to point out as well, you can configure the formatting that is output. Let’s say you have a field like the title. You can change what header that will be output as. You can even rewrite the output. You get a lot of control I think that people miss when they’re creating their Views. In this example, it’s probably hard for you to see on the small screen but you’ll see you can add a level field then exclude it from display, and it becomes then a token. On the right, what I’m showing you is that you can add it as a CSS class. It just gives you a lot more flexibility of how you rewrite the output of your view.

You then choose the type of display. You probably do this in an earlier step but it makes sense at this point to think of you can either output page displays or block displays. There are RSS feeds. There are a lot of other displays that become available as well when you add contributed modules.

Just to give you a sense of like the output, for example, let’s say I created this table of recipes. If you can see I’m inspecting the code there, you can see that the level or intermediate, for example, became a class on that table data cell, so that will give you some ability in CSS. I can make that color a specific color or something like that.

So just to recap, we’re going to choose what to query. We’re going to limit the selection. We’re going to select what we’re going to display, whether it’s Fields or View modes. Then we’re going to configure the formatting and then we’ll choose the displays. Let’s go and do that. We’re going to do another demo. This is the second demo. Hopefully, everything works out.

We’ll be adding a block display to our news list. We’ll choose some fields. We’ll put it in the sidebar, and then we’ll change the fields and change the display and see how it works. So let’s get right to it.

Here I am in my news article view here. A handy way to get to edit the view is to go here on the little gear on a contextual link. I would like to add a sidebar block so I’m going to add a display. Now, I’ve got a block. Well, I’m going to give this display a name because I could end up with a lot of - News article list, I can put it that way, and then to put a lot of displays possibly. Probably for best practice, I should go here and rename this one – Front page news teasers. Do whatever, you could put some information like that, for example.

Here, we’re going to edit this block, News article list, and I’m going to change the format. I’m going to get a preview, first of all, like I don’t want all of this content showing up in my sidebar. That would not look good. I’m going to change the format from content. Oh, sorry. For selecting what’s displaying, we’ve already selected what we’re displaying just to point out that we’re already displaying the content type article. We’ve got something we’ve already selected.

So we’re going to change from Content to Fields, apply it in there and it should throw up an error. Fantastic. Oh, it should throw up an error anyway. It automatically added the field title. Oh, that’s fantastic. Okay. We’re going to add now I think a date will be good for the news list. Add a field, add a date, Content: Date, okay. I won’t need a label. You can change the format so just like a nice short date, Apply, and here we can see it’s not displaying. Fantastic. I love doing live demos and not realizing what I’m doing. Yes, I actually picked my date fields. This is good. Actually, it’s great to learn while someone else makes an error. I picked the wrong date. I picked the date field instead of the date the content was posted. That’s important. You could also choose by Updated date if you chose news, for example.

Let’s see if that worked. I’ll deselect Create a label and choose Short Format. I hope you’re all enjoying my live demo [laughter]. What an opportunity for comedy. So here we get the title and the date, so that’s okay. It’s coming along all right, but I’m going to go and change the format now because I’d like these to show up in a bulleted list. I’m going to change from an unformatted list to an HTML list and just see how this goes. Here we go, fantastic. We’re getting a bulleted list now that looks a little bit better. However, what I’d like to do is have the fields – I’d like to have the fields sort of running next to each other. I want them to show up in line, so go to the Fields Setting and select these fields to be in line. All right, so that’s a lot more – well, it’s a bit more close to what I was planning on doing.

I don’t want a pager at all on my news item. Excuse me, I don’t want a pager on my block. That’s just not going to look right, so I’m going to change it to - for This block, I will say Items to display, display 5, Offset, and – oh, sorry. Use pager. I’ll just click here, just Display a specified number of items. Yes. Items to display 5, sorry. So here we go, a list of news items with the date. It’s getting a little bit closer. I can already see I’ve made the error I was going to try not to make. Let’s see what happens. I added the block and I changed the options there. What I also overrode what happened on my front page, so it ended up that when I added the display, you’ll notice here I’m going to go Show Fields for example. I changed it for All displays instead of This page (override). That ended up overriding my default, so I have to go back and undo everything I’ve just done.

Let me go back to Fields, change to Content, and change to Teaser, Apply (all displays). That looks a little bit better and if I go back to my block, it should look… I hope you guys thought that was funny. Sorry, This block (override). Okay, get our Inline Fields.

All right, so here we go. We’ve got the front page news. Hopefully you can see it’s okay, and we’ve got the teaser showing up and then in my block, I get the News article list and we’re seeing just the bulleted list. Okay.

So now that I’ve created this block display, it will be available to me in Structure, Blocks, and it will show up down towards the bottom, hopefully the list, and we see the View News articles: News article list and I’ll pop it into the sidebar. Put it over here, it shows at the top. Okay, so that should show up in my sidebar second here, above my search form, back home and voila! I’m getting my title and my date.

At this stage, you should understand we’ve got displays. We’ve got the news display and we have the block display showing up, and you also saw what happened when I wasn’t careful enough that you end up actually overriding your displays. So I suppose you can’t put too fine a point on it. You just have to be careful when you’re selecting specific displays in the editing options. It’s something that generally tricks people up in the early stages, and as well best practices to name your displays and that helps you keep track. As you see, when you saw the block listing, that’s the spot what I was looking for.

Let’s recap what we’ve done. First, we selected and filtered with the news articles. We selected specific fields; in that case, we chose a title and a date. Then we change the format so we changed it to be a list. You saw me go back and forth between a list or the view mode, a teaser, and then we chose a display. We had pages and blocks.

Now, that you’ve seen the two demos, so where do you find yourself now? Do you feel like you know a little bit more what Views is? You’re on the – has your yellow or your orange dot sort of moved up a little bit? I’d like to hear what questions people have at this stage.

Moderator: We had one question come in that says, “I’m sorry if I missed this but are we able to add RSS feeds?”

Heather James: Yes, that’s a good question. Let’s look at how to do that. I’m going to go back to my environment here and let’s say, for example, I’ve got my news articles. What we’d like to do is especially on the front page, we’d like to customize it so the front page RSS feed only shows news items. Go back and edit. Before I make the change, you might be already thinking how could I add a list of RSS items to a view? So based on what you know so far, you get the idea that you can add displays. Right across the top here, we’ll click Add a display as a Feed. The Feed options are a little bit different so we don’t have the options, for example, to utilize Fields. It’s a little bit limited, but it’s just automatically formats your RSS feed as you need.

Let’s set a path here, so we’re going to say news stories. We’ll get an output and this is going to give me a preview what the RSS feed will look like generally. There we go, cool, so that’s our display. Does that explain it or no, maybe not yet because I haven’t saved it? Yes. Click Save. The Save button is at the top in Views as well so hopefully you won’t have any problems with that. I’ve actually seen plenty of times where people are working away on their view happily and then they’ll end up not saving what they’ve done. A sad day then. I should see a news – ah, fantastic. I actually will create this as an attachment, in fact. Maybe this would look better.

Another display we can do is an attachment. I’m going to just change one thing on the front page, Front page news first of all. It’s to actually change from five items to like two items, first of all, so we’re only getting two news items up at the top. The last display I’ll add is this front page sub-list, old news we’ll call it.

In the Front page old news, I’m going to change it so we have – I’ll show you the front page now. We’ll see the – what we’re going to do is have two news items and at the bottom, we’ll have like a bulleted list. Maybe I should show you guys something. Okay. I could close either views. So we’ll show you a list of This attachment, change it to HTML list. Instead of Content, we’ll change to Fields and let’s just show the title and save. I’ll remove the updated date from this list. So here’s a list of the other news items and instead of displaying 10 items, we’ll offset to three so we won’t display. There’s just three items that we’re only getting, a few of the options here. We’ll position this attachment After and attach it to the Front page news.

This is the last display to show you. I guess I was going to save this till next week but we didn’t have a lot, so I guess this went a lot quicker than I thought. Let’s look at after you save this, how it appears on the front page. So we see the news articles and there are two items showing up at the top and then the remaining news articles. It would show 10 if I had more news articles on this demo site, but that’s really the last type of display that’s available by default in Views.

Are there any other questions?

Moderator: Yes. We had a couple more come in. What theme are you using?

Heather James: This is just regular old Bartik. This is the default theme that comes with Drupal 7 and I’ve only just changed the logo. Awesome.

Moderator: Okay. The next question is how do you add a lightbox from each image that a view returns so a larger size image can be viewed in a pop-up window?

Heather James: A really good module for that is Shadowbox. I recommend it because it actually provides you – that’s a really good question. I’ll be able to show you next week so I’ll be showing you modules that extend what we usually do. What this allows you to do is it provides you a different display mode so you may think of – let’s say for news articles, for example, let’s go back to our Front page news and I’m going to mess around with this a little bit more just really quick. I’m going to change the Content to Fields for This page. I won’t make the same mistake twice, of course, and apply to this display. We’ve got title and an updated date. We’re going to add an image which is appearing in my node article there. You’ll see here we’ve got a Formatter, Image formatter and we’ve got the Image style, Medium, for example, and link to Content or File.

What Shadowbox will actually give you is another formatter option. There’s a number of modules that do something quite similar, but it will basically give you a formatter so it will have a display in a modal window. A lot of times these contributed modules are just extending what Views can do because it doesn’t have to do everything. It’s just things are offered from network to Views. I hope that’s clear.

Just see here, this is where we’ve done enough so far with messing around with the front page. Page display, this looks kind of horrible. So apply this, just change into an Unformatted list here and just to prove the point, I sort of showed you before you can change the style settings, even rewrite the output, for example. I’m going to change this to like heading three, for example. The image – oh, remove label. I’m just going to be demo-ing away here. I have a few more notes to add to the very end of this presentation here but if you have questions, feel free to ask.

What we’ve done so far, I guess, is you’ve got my idea that with Views, you get a lot of control over what you can display and how it displays. Oh, it’s fantastic. I’m so impressed that I keep on forgetting to do this. I meant to make the first time I did this, I didn’t mean to make a mistake. I thought I was being clever but yes, I’ve got time for questions. Sure.

Moderator: Okay, great. The next question is can you explain the difference between Views and blocks?

Heather James: Absolutely. What you see with Views is that you can create blocks so I’m going to rename this to be News block, for example. I could actually create multiple blocks with Views. I could add another block based on the same query of news articles, for example. Views creates blocks and then blocks are things you place onto the website, so we’ve got Structure, Blocks, and one of the things that has been output – let me just save this. One of the things in output is my News articles, News block. That was actually created by Views. There’s a lot of different blocks just by default. Drupal comes, for example, with a list of recent comments so I’ll just show you that default block. Let me put that up in the Sidebar Second under the Views block there. So blocks can be upped by a lot of different modules and you get some control over where they display. Does that make sense? Views creates blocks.

Moderator: Yes, great. The next question is will you be explaining how to export the queries, optimize them, and re-import them?

Heather James: Yes. Actually, that’s exactly what we’ll be doing in the third part of this. If some of this is a little basic for you, you already know a bit about Views, in the third part of this, we’ll be taking and exporting everything. You’ll be able to see how to export everything you’ve created and save it as a module. Let me just show you. I want to go to Structure, Views. You’ll notice, for example, with this News articles view, I can go ahead and just delete this, which is kind of scary. I can go and edit it and all the changes I’ve made and all that work I did could get lost instantly. What you’d be able to do with the module is have a list of content and I’ll show you one that I actually have, the one I did at a Drupal camp. This one here is not deletable because it’s actually saved in code, so there’s in database overriding code but I can also revert it and it will revert back to what’s saved in my module. So it’s a safe way to back up your Views.

The query that actually gets created is sort of helpful. I think if you want to look at the query itself – sorry, I have to go back to my settings. Go to your Advanced settings here and you can show the SQL query right when you’re looking at it. You can also show some of the performance and how it’s running. Let’s just look at the SQL query for now.

Okay. There you go. Here, you’ll see – if you already are a person who knows how to write database queries, you can get your insight here. Oh, my worst fears have come true. My unprofessional cat has showed up for this webinar. I’m sorry about that.

I’m going to just finish up with some final notes. I know that you guys are giving your time over to this and I just wanted to give you an idea of what I’d like to do over next week. If you’re brand new to Views, I’d like you to go ahead. Based on what you’ve seen so far, create a view yourself so this would be listing of specific content type or maybe all the terms on your site, and create a page display and a block display and then place the block in the sidebar of your site, just the same way we did.

I actually created a tutorial which has just four- or five-minute videos, 20 minutes, so I go through these steps very clearly and you’ll be able to complete that activity. When you show up next week, you can ask me questions more specific to the problems you run into.

If you are a little more advanced as well and you want to learn more, there is a webinar available that was just done yesterday with my training partner, Suzanne Kennedy from Evolving Web, as well as there’s a Mastering Views course actually happening at DrupalCon, so if you’re going to be in Portland, that’s a really great opportunity to get a lot of detailed help with Views.

Then we’ve got some Views tutorials so I mentioned my quick one there. There’s also Drupalize.me that has a great series. It’s not free. There are some free ones there. There’s also a free 10-part series with the Toronto Web Developer, Pete.

That should give you enough help so that by the next time we meet, hopefully you’ll come to the next one on May 8th. We’ll give you a lot more detail on how to build flexible views. Please do sign up for that one as well.

I put up all the notes from this class and all those links. I figured it was probably quite a lot of information. I’ve actually put them up on our blog and so you’ll be able to get access to those tutorials.

Of course, please do come and check out our events. You can meet me at Dublin Drupal Dev Days as well if you want to talk more about Views and configuration. I’m just going to show you that blog post there.

We have about a few more minutes. I think we’re closing soon, but are there any other final questions?

Moderator: Yes. There are a couple more questions that came in. Is there any limitation on the number of blocks we can create in Drupal? Can we create more than 256 blocks?

Heather James: That’s a really good question. You probably – what’s interesting actually about the various displays, you could keep on adding displays to this view and if you think of it, it’s really just variations on the same query. If we’re querying very similar content, it makes sense to just simply add a display. If you’re at the point where you’re adding 250 blocks, you probably have a different need, so I’m going to give you just a hint of how this is done.

Let’s say we had a news page or we have a news article obviously here. Or actually I may have something already created. Let’s look at one I did earlier. I look at the cooking, for example, cooking recipe here. We’re looking at this baking recipe. What we want to show are related recipes and we don’t want to be creating a new view for every single recipe on this site. I’m just going to click on – I’m trying to find one that actually has one. Let me get the baking recipe, or maybe not. Okay. Let me hold on a second. I could get something that’s related based on taxonomy terms. Right. We’ll be showing you this on the next one, but just let me try and do a very quick explanation.

Let’s say you have this recipe here for beginners and you wanted to show in the sidebar other beginner recipes. Well, you wouldn’t want to have to create all of those different blocks for all of those different levels. What you’d actually use are contextual filters, so what it will allow us to do is create a block. For example, we can create a view and I’m just going to quickly see if I can do it and get under the Related levels. Show Content of type Recipes. You don’t want to create a page. We’ll create a block, and we’ll just make HTML list and I’ll Continue & Edit. I will do this in a lot more detail next week, but what we’ll be adding are Contextual Filters. You’d probably do something like this where you will say, “Show me content that’s related by level.” They’ll take the taxonomy term. There’s a lot of magic that goes on here but hopefully it will give you a sense that you could relate content by level. If my demo works out okay, everything will be fine.

The tutorials, by the way, that I’ve linked to you here, there is actually a tutorial specifically on how to do this, so it looks like we’re going to run out of time anyway. Let’s say, for example, we had the setup. Let me see here. I’m going to display this content of title, okay, that’s fine. I’ll save this. Structure, Blocks, and I’m looking for my recipes block I just created, related recipes. Oh, I already had related recipes. Related levels, there we go. Sidebar Second, put it up to the top, and save it.

We’ll go back to our recipes page, show a specific recipe and – sorry. Someone who has done live demos before is laughing at me right now. So we’ve got – oh, that’s not even the related recipe, sorry. I’m sorry [laughter]. I’m looking at the wrong view. Oh, can we cancel this? I’m sorry about the demo. I’ll show you this next week and I’ve actually created a step-by-step instruction about this. Let’s just say if you’re going to create 250 blocks, you probably need to choose Contextual Filters. I hope that was a good enough answer.

The other problem with it is if you are creating views that have a lot of different content, you don’t want to be adding extra displays because you’re just going to be overriding a lot. Once you start adding, say, more displays instead across here, it’s just becoming unwieldy, difficult to maintain and manage. You’re not getting any benefits.

The other thing is if you have a lot of data being pulled into your view, like if you have a lot of different fields and you’re doing relationships and joins, for each one of those displays, all that content gets loaded, so that’s something to consider. You really only want to use multiple displays when a content that’s being selected is quite similar.

I will talk to you next week about caching your queries to make them a lot faster and what effect that has on your site as well. Are there any other questions?

Moderator: Yes. We had a few more. The next question is what is the difference between one view with many displays versus many displays? When do you use a new view versus a display?

Heather James: Yes. I hope that what I’ve just said there sort of explains it. The displays are just to help you create similar lists of content so I actually was going to show you on our upcoming training site, for example. We have a list of European, global, or Canadian, U.S.-only events. If we actually looked at them, we have these individual lists of content. They’re actually quite similar across all the various events. They look exactly the same. They got the same format and the only thing we’re changing is this information that’s coming to the URL here. Those are multiple displays in the same view because the content is very similar and the only thing that’s changing is this variable of the filter criteria of the location. In that sense, we’re getting a benefit from using multiple displays. This just happens in Drupal 6 but I hope that it’s clear from what I said.

Like I said, if you keep on adding multiple displays and you added more data through making a relationship, as you’ll see next week, the pulling in things from another table, all that stuff is loaded for each one of the displays.

Moderator: All right. Thanks so much, Heather. Again, the recording and the slides will be posted at Acquia.com website in the next 48 hours. Heather, do you want to end with anything?

Heather James: Yes. Thanks everyone who showed up. I‘m really sorry that I had a few hiccups myself. It’s my first webinar so I really appreciate you sticking – it’s my first webinar in a long time, I should say, so I appreciate you sticking with it.

I’m going to – hopefully, if you got any questions through the week, we’ll be able to get them answered for you. I’m hoping that you’ll give it a try this week and come in with questions so we can talk about what kind of trouble you ran into as well.

Moderator: Great. Thanks so much.

- End of Recording -

Click to see video transcript


Moderator: Today’s webinar is how New York’s MTA uses Drupal caching to get riders there on time. Our speakers today are Ray Saltini, the Drupal evangelist from Blink Reaction and Evgeniy Kashchenko, who’s a project manager of Blink Reaction. We’re really excited to have them on the call today and we hope you enjoy their presentation.

Ray Saltini: Great. I’d like to thank you all for coming today. We’re going to get started. I want you to know that we’re going to tell you briefly who we are at Blink and what we do. I’m going to talk a little bit more than we specifically do at these sort of presentations about the significance and contents of this project. Then let’s jump right into it and do an overview. From the important PM considerations, we’ll talk about the technology needs and how that fit into architecture and implementation of the project, and of course, we’ll give you a couple of different resources. First of all, Blink Reaction is privileged to be providing services for some Fortune 500 organizations and large government non-for-profits. We’re particularly proud of our efforts to train in the Drupal stage. We see that really is our biggest contribution to the Drupal community that started to help level the playing field and also advanced innovation and integration with Drupal. We are active in the community; enjoy our support of it and hope to see you all, one way or another, at an upcoming event. So first and foremost, let’s talk a little bit about - where did we go about the Ocean Railway, as we talked about it. We had an opportunity to work on a transportation project in New York City. Obviously, the technology component, as opposed to the bricks and mortar infrastructure of it, but the transportation is a critical issue in the cities, in the US in particular. One of the things that we were just very aware of is how important this was to the MTA. If you’re a student of New York, you can understand that the health of the city - the transit system is often used as a barometer of the health of the city. So we took this project very seriously. Back in the day where that analogy was made for packet service, there are a whole lot of ships and boats on Long Island. The first efforts at transportation solutions are on the ground or above the ground - as the case may be - solutions were just being dreamt of. The subway - planning it out and developing it is not unlike the process that many of us go through when we plan and build interactive web applications. Once the prototypes got a little bit more reasonable, we both understood that they would actually start having to build underground. Of course, remnants of the above ground systems still exist all over the place in the boroughs. You can see just from these old shots, just what a tremendous major initiative it was in New York City - for nearly 100 years at building and maintaining the system. Eventually, they got three different companies to service their link. So, we took this challenge very seriously because it was part of an effort to really create a solution around the inevitable problem of delays and service interruptions and the like of which you can see that this old cartoon demonstrates, that the MTA as well as other urban locations throughout the globe have dealt with for a long time. It really was an attempt to bring us back to the future. So, this was a problem in the service which first opened a challenge to inform riders. We have a lot of folks looking over the platform. That was the highest technological solution at the time. Things weren’t much different in the ‘70’s, then they got a little bit weirder and in the ‘80’s, they got downright scary. Now, in the ‘90’s and the new millennium, we can see that as much as things change, things often remain the same. So it’s this historical sense of gravitas that everyone, from a large project staff, went into working on this project, dealing with legacy systems, analog systems, but really trying to service these incredibly large numbers of commuters. We joked amongst ourselves when we were doing this presentation that the MTA, in fact, does keep track of passengers entering the subway system, but they don’t necessarily keep track of passengers exiting the system. Beyond that joke, this was a huge undertaking for the MTA to plan for a number of years, and despite the one step further and one step backward implemented scheduling of service, they have made tremendous progress. What they wanted to do with this project is bring that out of the tunnels, off the platforms and into the hands of people that could distribute this information. So, as the MTA upgraded their infrastructure, they’ve been able to pass this information along but also a faith in the tremendous challenge of it. It’s at this point that I want to introduce Evgeniy Kashchenko, a project manager - enterprise project manager for Blink Reaction who helped managed a team of talented developers and committed stakeholders.

Evgeniy Kashchenko: So, MTA was already transitioning to Drupal and, therefore, continuing to build and Drupal made sense, and data mining the website was built using Drupal 7 and it’s installed on Acquia’s cloud. So, we worked in tight coordination with many groups here. Of course, MTA provided the requirements. They also provided the overall look and feel and branding standards for the site, as well as the most important key thing, which is the train’s data. From our side at Blink, we managed the project, did a lot of custom development, triple configuration, configured cache, and created a separate mobile app to demonstrate how the feed can be used. So we partnered with Acquia on this and the Acquia team worked on project management, as well on clients communication, configured the technology stack including Varnish and provided a lot of types of services through their partner. So, let me show you the screen of the website. Here it is. It’s taken from the data mine that was provided. So, the goal was, again, to make of it after a second information about MTA services to millions of New Yorkers and visitors. This Drupal website allows developers to create an account and obtain an API key to access those feeds created by MTA so that they can build apps to inform riders and others about scheduling and service notices. So, this site is integrated into MTA’s portal and builders of its integral part. They started to announce the launch of this platform and given the access to their data started in full and it put a lot of pressure and stress specifics to meet the deadline.

Let’s jump to the next slide. This is how the dashboard looks for a developer who already registered. Basically, all you need is your MTA key, which is shown on the right. This is the key that allows you to get the data from API’s. So it’s straightforward. To register, you can do it yourself just by going to the MTA’s info website and providing information about yourself. Right now, it’s a pilot with a couple of trains’ data, but they are looking to add more in the future as they become available because a lot of infrastructure changes to switch from analog tracking to digital needs to happen so that this data can be gathered and then presented to everybody.

So, let’s talk about projects management a bit. As a key to successful project delivery is communication and track of coordination with everybody who’s involved. One of the tools that helps to achieve it is the RASCI chart that is presented in the screen right now that basically allows you to outline the main responsibilities and activities on the project and assign those to specific individuals. Besides, you would probably want to create a communication plan in defining cadence participants in the format of the different meetings, calls and reports, which in our case was the weekly status reports that were combined with calls and screen sharing for demo purposes. Of course, you would be willing to be on top of your dependences and risks to make sure that they are mitigated in time. So, this project was in a very aggressive schedule for three months, including discovery, and we added more resources to make an update and also caught in some review time, but we know that basically, at the end of last year, Hurricane Sandy interrupted and, basically, drove the plans. So that’s why MTA had a lot of work to do with their infrastructure and the actual launch was delayed. So, iterations that we went through were discovery, which included specs, information architecture and designs. Then there were three sprints of development with demos and reviews and two separate launches because we were launching two apps - the portal itself and the demo app. Now, let’s talk about the solution itself.

So as I mentioned before, it’s Drupal 7 with heavy use of Varnish and other types of caching, widely used contributed modules, five custom modules for theme, for ESI, for flush of the cache and for messaging, and as everybody can register to the website, it’s made opened so that you can access the data field at once and only if you’re abusing the service, then your account will be deactivated. Another part of this which is a real-time feed that is provided in the format of GTFS binary file, and then some static feeds are also provided as a separate service. So if you don’t know much about ESI includes its technology that strives to resolve the problem of web infrastructure scaling and bring more awe to the edge. You can look up more on these types of caching. So, in our case, Varnish was used to basically cache the data and, again, this is the page that shows you it’s documentation that it can be accessed online at Varnish cache docs. So let me show you the architecture of the app. So how it works is the developer comes to the website, registers using the web form, then the data is stored in Drupal and access key is generated. Then the developer can access API using this key. This API is proxied by Varnish for scaling purposes, because Varnish helps us to get the reply to user tester if we know who the user is and if data is still valid. So, as this is real time application, the lifetime of a cache for the data itself is just 30 seconds which is displayed in here. The other part, which is also cache and Varnish is your API key validness. That is a longer period. So how it works: first, request is sent to a standalone file in the dark route, which is this wrapper. It checks the API key in Drupal if it’s valid or not. Then if it’s valid, it’s stored in Memcache. Then the data is provided to via Edge Side Includes. Basically, what it is is just like a tag in the reply that is then polished by Varnish and the appropriate file is entered into the database instead of your tag. One of the key performance indicated for the project was load and sustaining load. So in this case, as I mentioned before, Acquia partnered with SOASTA, which is distributed to our testing provider that can hammer your service from around the globe. What we were able to prove with this load testing is that our solution is handling five thousand users per second concurrently with the architecture that was built in place. That’s about it about the portal. Now, I will transfer the presenter to Ray and he can talk about the demo application that shows you how you can actually use this data and get some real results for that’s worth and can be used to actually know if the train is on time.

Ray Saltini: Then getting actual - if you don’t mind, let’s just keep it on your screen and I’ll speak to that. It might just be more expedient since I’m going to be…

Evgeniy Kashchenko: Yes, absolutely!

Ray Saltini: Thank you. Good. Great! We have these two ends of this project. Obviously, the caching of the rights and credentials of the data, but what we were also asked to do is put together a very quick demonstration of how developers could access feeds from the MTA and, in particular, these real-time feeds. Typically, what the development community that the MTA has been supporting for quite some time now if there’s some increase transparency and other feeds that would develop a native phone application if you will. In this case, the business requirement from the MTA was to actually develop something in Drupal. That actually posed some challenges in particular, because some of the transit feed specifications did not have a native PHP parser. Effectively, at this stage of the project involved setting up a completely standalone Drupal 7 site and is a terrific demonstration of how Drupal can be used as a platform to serve a mobile application. We developed a response as a theme specifically for the iPhone, a mobile web theme and used fairly typical modules in Drupal’s contributed modules section to accomplish this. What was not easy about the project, of course, was this getting around the fact that there didn’t exist a partner for the transit files used by the transit associates of the MTA. So we were able to actually tap and customize a library that contributed for this that’s available on get hub. We actually had to rewrite parts of it because the stack that we were on - we built up - in one version of PHP and the library file, the general transit spec library parser for it, we built around a different version of PHP. So, what you have on your right is an actual copy of the general transit feed spec that’s used to convey this information. The real-time data is actually a binary file, but the static feed is a CSP file which we actually didn’t handled directly, but the two feeds were matched up in the application to give users the ability to actually go ahead and select stations which obviously is a static lists of stations and then the actual arrival time of their train. So, one of the things that we can do is go to a quick demo of the MTA site. So, if the folks would - I guess that would be helpful if you want to switch over to me - if Evginey have that, I should have that up here on my screen if I can manage to find it.

Evgeniy Kashchenko: Yes, maybe I can turn it up. Just give me one minute. It’s just a bit slow with the screen sharing, Ray.

Ray Saltini: Yes. [Pause] I have it up if you want to transfer the point. [Pause]

Moderator: Ray, I passed it to you so you could share your screen.

Ray Saltini: Terrific. So the folks can see here that we’ve actually got a - it’s really optimized for the iPhone and it’s limited. The choices of course are limited by the infrastructure that the MTA has in place to actually deliver the feeds for a particular line, but if we can take the local line and then we get a little map presented here. Then we get to choose to see when our next train would be at a particular station and click 168th Street in Washington Heights. This is something that you can actually try yourself if you go to datamine.mta.info. You’ll see this application on your lower right-hand side, and then click and you’ll get your arrival times for the next several trains. So, it’s a very, very simple implementation of this feeds technology, but it’s the implementation that is being expanded upon everyday by the developer community. It is leveraged by more and more feeds that become available through the MTA. That is the heart of the matter on this application screen. Never maximize your screen when you are using two monitors. Okay. So whatever’s down here…okay. So, one of the things that the MTA has done is really engaged and invested in the open source and the developer community and terrific resources of MTA, developer resources group on Google groups, as well. That and, of course, some of the technology sites that we showed you around, Edge side, includes and the transit feeds and Varnish will help you leverage this kind of implementation for your own projects. I think that this was a very out-of-the-box implementation of Drupal and, although it was a very robust enterprise level website platform, more and more we see it every day being used to create very robust, sophisticated web applications. We also saw an atypical implementation of Edge Side Includes with this. The limiting Drupal bootstrapped to really accelerate access to that level of caching. It was an important part of the engineering and architecting work that the team was able to accomplish with this project. We were actually able to ratchet the system up to 5,000 hits per second, specifically, so that the system could accommodate increased load as in the median term. So, although they only have one feed set up and running at the moment, the system was really built to handle increased capacity on an incremental phase and basis. It really is an opportunity to show off the robustness of Drupal and some of these other technologies when they’re planned out and built carefully and optimized. So thank you for everyone’s time and indulgence. If we have some questions, and if there are some things that we could provide some clarity around, we certainly will.

Moderator: Great! Thank you so much Ray and Evginey. If you have any questions, please ask them in the Q&A tab right now and we’ll get to them. [Pause] It doesn’t look like we have any questions. Ray and Evginey, do you want to end with anything or contact information if they think of anything?

Ray Saltini: Yes, absolutely! We are available at blinkreaction.com. We offer a growing selection of introductory and advanced Drupal training classes. We, of course, do professional services work on the front and back end as a function of our relationship with Acquia. We’re just looking to have the opportunity to share. Evginey, I don’t know if you want to add anything…

Moderator: We actually have some questions that came in if you wouldn’t mind answering them.

Ray Saltini: No, not at all.

Moderator: Okay. The first one was, what was the biggest challenge with the parser?

Evgeniy Kashchenko: Basically, it didn’t exist and it existed for another version of PHP. We needed to adapt it. It’s short end syntax, the use of name spaces and stuff like that. So we needed to scale it back to Drupal 5.2 because that’s what’s available on the hosting. Basically, that’s how we achieved it.

Moderator: Okay. Great! The next question is how do you handle caching for authenticated sessions?

Evgeniy Kashchenko: Yes, sure. So, basically, there are many different ways to do it. So, specifically, for the back-end, we use Edge Side Includes and that’s how we are able to sustain this huge load with verifying the keys and still providing the almost real-time data which is cache just for 30 seconds with the use of Edge Side Includes. For front-end, it’s basic or standard Drupal caching that has provided blocks caching to use caching.

Ray Saltini: So, through the use of this caching that Evginey is speaking of, we were able to limit Drupal’s bootstrap. So, we didn’t need to move a full instance of Drupal in order to update the cache at any one given point in time to check developer credentials. This was handled in cache. If at any one given point in time a development credentials have been revoked, the access rights for that particular developer or their access to even a particular feed will be selectively removed from the cache. That was an important - this concept of limiting Drupal’s bootstrapping is very essential. So, we used it for what we needed.

Moderator: Okay. Great!

Evgeniy Kashchenko: Yes, and actually there are a couple of other questions about how it works internally. So, I have two more slides that I can go over for specifically for what’s stored in Drupal versus what’s stored in cache and how it all works and how the results are matched with GTFS data. So, I just saw a couple of questions about it. So, if you want to make me the presenter…

Moderator: Okay. Let me pass it over to you. [Pause]

Evgeniy Kashchenko: So are you passing the presenter to me then?

Moderator: Yes, you have it.

Evgeniy Kashchenko: Maybe it’s on the way [laughter].

Ray Saltini: Maybe it’s still seeing the Acquia presentation.

Evgeniy Kashchenko: Yes, I still see questions slide.

Ray Saltini: Is it me who has it?

Moderator: You’ll have to re-share your screen. [Pause]

Evgeniy Kashchenko: Okay. Let’s see. Does it work?

Moderator: Yes.

Evgeniy Kashchenko: Okay. Cool! So, I hope this will answer some of the more technical questions that were asked already. So, that’s a bit more detailed architectural diagram of how it works or the data flow. So here is how they request to go through and basically what happens is when somebody tries to request a feed through the API, the request is sent to Varnish. That request is actually for MTAESI.PHP. That’s the wrapper that basically checks your key validness and then includes - we have ESI, the real-time data. So, Varnish first tries to look up the cache for this page in the internal memory and then if it’s not found, it goes to the back-end to actually get it. What happens here is we first check in Memcache if we know this key and, if it’s valid, then we can basically return the data on this step. If not, then we will need to load Drupal at the lower bootstrap level and that’s basically the level to actually get access to the database. The bootstrap steps are on the right of the screen in here. So, we take first the three but the rest is kept. This allows us to save a lot of time of Drupal configuration. So again, we’ll level bootstrap Drupal. We are getting the information about the key from Drupal database and make sure that it’s valid and after that, we can store it in Memcache for further reference and we can return the ESI tag to the data file which we do in here using this ESI tag that is on the right. Basically, the path in here is the location of this file on your file system. It gets there by MTA pushing it to that location so that it is up to date all the time. So, we serve this tag with PHP then Varnish understands that it’s not something that he wants to return as is, but it needs to be switched to the file that is in here, which is done, and then it’s returned back to the consumer. So, basically, Varnish does two different types of caching. First, it caches the MTAESI.PHP file with your access key and that duration is 30 minutes, whereas the included file itself is cached only for 30 seconds because that’s the frequency of the updates and we want the data to be up-to-date. So, basically, what it allows us to achieve is that this file where ESI is included is shared among all of the requests. So, basically, first it requests to Varnish, populates it and then it’s just searched from cache, whereas a request to ESI-PHP is key specific. If you have access to the service within the last 30 minutes, then Varnish will remember you and will give you the file it wants. Otherwise, if it’s like an hour or a couple of hours, then we’ll still have the data about the key in Memcache which has a longer period of life for your key. If the key is for some reason deactivated by an admin personnel, then it is also removed from the Memcache. So hopefully this explains why they needed that they also know how the cache is done for the API portal. Now, to talk about the demo app and how the data is matched there. Basically, we have two types of GTFS data files here. One is static and that one has train schedules - basically, trains names and stations that were there; whereas, real time has actual delays or any changes in the schedule that are there. So the static data doesn’t change that often, like maybe a couple of times a year. It’s cached in Drupal tables. So, basically an admin personnel can refresh it at will when they need to, and it will be updated in Drupal tables, whereas real-time GTFS data is parsed by this protobuf PHP module, which can be found on gate hub by default URL. So, what it does is parses this binary data file and populates it to Drupal cache so that when users come to the website, we can get the data about lines and different stops on them, and then map match it with real-time data to provide the results that you saw on Ray’s demo. So, I hope that helps and we’ll look through the other questions that you might have.

Moderator: Okay. Great! The next question is, is Drupal storing data from the parser or simply rendering it? If it’s just rendering the data, do you have to write a custom module to interpret that data and output it into the view?

Evgeniy Kashchenko: Yes, basically, that’s what I just went over. So the real time data is parsed by this protobuf PHP by Ivan Montes. Then it’s stored in Drupal cache.

Moderator: Okay. The next question is, how many instances of the app do you have for the load? How scalable is this?

Evgeniy Kashchenko: There are a couple of servers that are shared among a couple of different applications that MTA has. So it’s not only this demo app and API portal, but it also has some other Drupal applications that MTA already built before. What makes it informant is actually the caching architecture and infrastructure that is put in place.

Moderator: Okay. Great. Are there any real-time statistics? Let’s say - how many users are using it at the same time?

Evgeniy Kashchenko: There are some based on operational data. There is a plan to add more of real time monitoring there and generate administrative reports, as well. That’s something that is planned for the next phase. In terms of real numbers, I’m sorry. I just don’t have those [laughter].

Moderator: Of course. The next question that came in is, so does it mean that the entire cache is being flushed and rebuilt every 30 seconds?

Evgeniy Kashchenko: Let me go back to this slide. I’m not sure which application you’re asking about but if it’s API portal, then the part with your key is cached for 30 minutes within Varnish and a longer period within Memcache, and the file itself with the real-time data is refreshed each 30 seconds. If you’re talking about demo app, then again, there are two pieces in it. For the static data, it is refreshed as needed and real-time data - I think right now, it’s set to a minute or so. So again, it’s an app for demo purposes. The intention is for other developers to understand what data is inside and how it can be leveraged.

Moderator: Okay. Great! I think that’s it for questions. On my end, the recording will be posted in the next 48 hours to the website and we’ll email it out to you. I want to say a big thanks to Ray and Evginey for presenting and thank you everyone for attending. Evginey, do you want to end with anything?

Evgeniy Kashchenko: No. Thanks a lot everybody for joining us today and let me just share this slide. So basically, you can reach me or Ray at the emails that are on the screen. It’s ray.saltini@blinkreaction.com or evginey.ka - oh wait a minute that’s misspelled. It’s s-h-c-h-e-n-k-o@blinkreaction.com.

Moderator: Alright. Thank you so much.

Evgeniy Kashchenko: Again, thanks for participating today.

Moderator: Bye.

Ray Saltini: Thank you.

Pages