Hi! Here's what I'd like to do.

I want to put a view (or block) on a bunch of different pages on my Drupal 7 site. Each time I use the view, I plan to do something a little bit different with filters. Some examples could be that if I go to page "food", I can use that view to show all articles with author "Jeff", or if I go to "cars" I can use it to show all articles written by "Terri", past Jan 1, 2017 and "Michelle" before that date).

Obviously, I could accomplish this by creating different views for each page, but that would be a pain! I have a lot of pages, which means I'd have to make just as many views, and that's an extra step if I want to add or remove a page.

Is there an easy way to accomplish this? I'm guessing I can either add a conditional logic to the view using the admin panel (so that if it's this page, then do that), or add something to my code which inserts logic into the view? Maybe I can add the exported view information to a PHP template and change the variables using my own lookup table? Or maybe add something into the call like print views_embed_view('latest_posts_group', [logic], 'default');?

Thanks!

Comments

Jasonrj’s picture

Edit: never mind, I didn't read fully. I'm not sure how to achieve this.