Question

I have a page generated by Views which lists 5 Articles at a time. This view is paginated so that page 2 of this View will list the second batch of 5 Articles, page 3 will list the third batch of Articles, so on and so forth.

My question: is it somehow possible to extract fields from Articles listed on the page you're currently on, perhaps via the url? And I only want to them on the Articles being displayed by the page the viewer is currently on and not all the Articles.

My intent is to have a Views Block that would ...

  1. determine what page of the paginated View above you're looking at
  2. determine what Articles are listed on that specific page
  3. aggregate and display the Taxonomy Terms of those listed Articles (Articles have a Taxonomy Term field) in the block
  4. do all the above automatically as you change what page you're looking at

The way I'm going about this is to list all the the Taxonomy terms in a block which is relatively straightforward. What I can't figure out is how to filter it based on what Articles are being displayed to me in a paginated page.

I was thinking maybe this is possible to use it using the url of the paginated page which goes along this format: ?page=1, ?page=2, etc.

If anyone could just point me to the right direction, I would appreciate it. I'm also open to alternatives.

Was it helpful?

Solution

What if you created another display of the same view as your Article page view?

You could add a Relationship for the Taxonomy Terms and then the Fields in the block view would be the appropriate fields from the taxonomy terms. You'll want to setup the same Filters, Sort and Pager options for the two displays are the same. That way the results should match.

Then you might just want to hide the pager from the block view. You could do that through a custom template for that view display, or maybe a preprocess function that hides the pager for just your view, or maybe via CSS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top