Views Examples Settings Page

A collection of views examples that can be turned on and used directly within views. You can use the views examples as-is on your site, or you can clone them and use them as a starting point for further customized views.

Although this module works, it will likely be rewritten as a features package in the future.

How to Use

  1. Enable views and views_examples modules.
  2. Go to views_examples settings page: /admin/settings/views_examples
  3. Turn on the examples you would like to try out. Some examples require additional modules which are noted. You won't be able to enable those examples until the required modules are enabled.
  4. Go to views build page: /admin/build/views. The enabled examples will be shown.
  5. Click "clone" for any example you want to edit. This is not strictly necessary (you can simply edit the example view itself) but, if you clone it instead, you will be left with the original example view for reference.
  6. Edit your cloned version and play around. Preview results of the view at the bottom of the page by choosing the display and then clicking the Preview button.
  7. Have fun!!

Current Views Examples

Most of the examples thus far are fairly simple. One more complicated one is the Similar by Terms example.

  • Recent referrers block and recent access page.
  • Recent comments blocks, recent comments page, and search comments page.
  • Recent files blocks, recent files page, and search files page.
  • Show nodes that have most matching/similar terms to the given node.
  • List of vocabulary terms grouped by vocabulary.
  • Recent users block, recent users page, and search users page.

Adding to the Library of Views Examples

You leave a feature request for any view you'd like to see added, and I will try to add it. The example *can* depend on other modules, but I just need to know what modules it depends on. For example, maybe you want an example of adding a views block of all flagged content (no matter what flag). That would obviously depend on having the flag module installed.

If you would like to contribute any example views, please leave a feature request and paste in the export text from the view (in <code> tags) and write a description of what the view does. If there is little overlap with other examples and it is something that general users may want to use, I will try to add it. If I add it, I will add a comment in the corresponding view example file with your name and drupal.org profile page URL in it so people know it was contributed.

Maintaining your *OWN* Views Examples Library

If you already have a collection of views that you like to use and, for some reason you don't want to contribute them to this module (maybe they are owned by your clients or they are too specific for your projects to be of general use), you can still utilize them through the views examples module.

Currently, this module is set up to find any example files in the contributed modules directory (e.g. sites/all/modules) to "suck" into the examples list. It is done based on file extension "vex". A "vex" file is simply and exported view with a <?php at the top of the file. The name of the file needs to be the name of the view. e.g. if your view is called "my_cool_stuff", then the filename would be "my_cool_stuff.vex".

Right now you have to have a companion ".info" file (e.g. "my_cool_stuff.info") which has info about your view (name / description / dependencies (if any) / package (if any)). I'm thinking about making this optional (then name is filename, description is from view code itself, and package would be "Other").

Sponsors

This module was written and sponsored by Kristen Pol. If you have any issues or want any new features, please open an issue.

If you would like to sponsor enhancements to this module, please contact me.

Project information

Releases