O'Reilly logo

Drupal for Education and E-Learning - Second Edition by Bill Fitzgerald, James R. Robertson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Views and PHP snippets together

Individually, both the Views and PHP snippets let us do some amazing things; when used together, we have even more options. In this section, we will cover one technique that uses a snippet to pass arguments to a view. This technique can be adapted to different contexts to provide some very powerful methods of creating dynamic navigation paths through content.

This can be very useful when tracking posts in a site that uses Organic Groups. In our example, we will create a view that takes two arguments: the group ID and the user ID. These two arguments will allow us to display all of the posts created by a specific user in a specific group.

Our PHP snippet will display a list of groups to which the currently logged ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required