2

I'm working with Views and Panels and I am having troubles keeping the results of a View argument within Panels.

I have a content type for events, and I want to display a list of previous events grouped by year. Through Views, I created a Views panel with an argument based on the year of the event date to display the list of years (2011, 2010, 2009, etc.). The Views panel displays just fine within my Panels variant, but whenever I follow one of the links, the results are not within Panels anymore.

I'm sure I'm missing something very obvious but I can't seem to get this to work properly.

  • 1
    What kind of display do you use to embed into panels? Is it a calendar? A block, or a full page? IN general the content pane display is probably what you need, and especially it's helpful to override the path of the view, which is your problem here. – Daniel Wehner Apr 26 '11 at 5:46
  • Sorry it took awhile- I accidentally overwrote my Views while trying to figure this out. I am using a Content Pane with Use Panel Path setting in the view turned on. In the preview within Views, the argument correctly sorts content by year and shows all related nodes for that year when individual years are clicked on. However, on the actual page that has the content pane, clicking on the years returns to the same page but without any content displayed. The URL within views appears as /admin/build/views/ajax/preview/programs/panel_pane_5/2001 while the same URL on the page is /node/4/2001. – Bob May 7 '11 at 16:28
1

Ok, I think I have this sorted out but wouldn't mind some advice if I went about it the wrong way. To recap, the goal was to have a list of previous programs sorted by year and have that results page stay within the layout set in Panels.

Within Views

  1. Create a Content Pane to filter out only the programs content type with the Argument set to display a 'Summary, sorted descending' based on the year of the program. This will be used to display just the years of the previous programs in a list and will be added to main Programs page.
  2. Create a Page to filter out only the programs content type with the same Arguments. Set the path of this page to 'programs/previous'. This will be used to view the actual results of the list created above.

Within Panels

  1. Create a new Page with the Path set to 'programs/previous/%view'. In the Arguments section, set it to Managed Page. In the Content section add the page created within Views and make sure the Send Arguments option is checked.
  2. Within Node Template (which controls the main layout of the entire site), add the Content Pane to the Programs page.

Therefore, when a visitor goes to the main Programs page ('/programs'), they will see a list of the previous programs in the right hand corner and clicking on each one will bring them to the appropriate page (such as '/programs/previous/2001') while keeping everything in Panels.

I'm a little confused as to how all works (for instance, how does the Content Pane inherit the '/programs/previous' path from the Page?) but am glad it works as planned. Hope this helps others and please don't hesitate to let me know if I could have achieved this in a simpler way!

Bob

  • After reviewing my own notes on this for another related project, I noticed I failed to mention that Panels Everywhere needs to be enabled as well to add the Managed Page option with Panels. – Bob Jul 2 '11 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.