Advanced Dynamic Pages with Drupal Arguments and Panels
****Caution, this Drupal arguments and panels post assumes you have both panels & views installed and some basic working knowledge of both.****
Last week I published a little post on how you could create a dynamic page simply using views and arguments; today we’re going to take that one step further and get a little more advanced and toss panels into the mix. For this example I’m going to create a simple dashboard of various content types that I have tagged featured.
- Create a new view and start by adding some default information.
- Add a filter of Node: Published (Yes) unless you want to show content that has yet to be published.
- Add an argument of Taxonomy: Term
- Add a simple sort criteria like Node: Post Date (desc)
- Add a new display of your view as Content Pane
- Add basic identification information, and any other general information that will be specific to only this view pane.
- Add a new filter on a per-Content Pane basis depending upon what type of content you’ll be using for that pane, something like Node: Type (Video, Image, Story). Be sure to use only one type per pane unless you intend to blend content from different areas of the site.
- Add the appropriate fields you want to show, some might be titles and teasers, while others simply scaled image or lightbox link to a video.
- Adjust your Pane settings to include basic identification information. The key piece is the Argument Input, be sure to hit edit and select From panel argument. (Repeat this step for all of your views) We do that because we’re going to pass one argument through the panel that will be received by all of the views.
- Create a new panel and answer the basic questions for layout and so forth, be sure to include a path something like http://mysite.com/custom-panel/%1. The %1 is the argument that will be passed from the URL to each of the custom views you’ve already created.
- Once you hit save you’ll see an option to adjust the argument based on context, we could do that now but it’s an advanced option that we won’t touch on in this tutorial.
- Choose your layout (I prefer flexible as I can put panes anywhere)
- Give your page a title; it can be supplied by the argument if you input something like This is a panel about %1.
- Hit finish
- Click the small icon that looks like a cog above the section you’d like to add content and the hit add content.
- Select the Views Panes tab to see the views you’ve created and then place the appropriate view, override the title if you like.
- Repeat step 7 at the various positions across the panel until all of your views have been placed.
- Click Update and save
- Now visit http://mysite.com/custom-panel/featured and you should see the dynamic panel you’ve created.