0

What this really boils down to is a contextual block view of terms with relative paths to a second taxonomy vocabulary, I'm just not sure on how to get there.

Here is what I'm trying to do:

I've created a basic block that contains links to taxonomy pages, but I need the links to which they point to be contextual based on the path that's in the current URL.

I have a content type that uses two different vocabularies on each node. One is a location type vocabulary of terms something like this:

  • Florida
  • USA
  • North America

Then I also have another vocabulary that contains a number of different award types something like this:

  • Award X
  • Award Y
  • Award Z

The same set of awards can be listed in each of the location type pages above as well.

By request we've created the Views to display the locations as pages, then the awards listed under each location.

So when we have visitor on the "Florida" page for example, we want to present a list of taxonomy links that point to awards by type, with the location included in the link contextually/dynamically. We don't want USA links showing on Florida pages, nor "Florida" links showing on "North America" pages.

Our path currently looks something like this from the Views Page displays:

domain.com/VIEW-PATH/term-name

domain.com/florida/award-x
domain.com/usa/award-x
domain.com/north-america/award-x
etc.

our taxonomy View pages look like this:

domain.com/term-name

domain.com/award-x
domain.com/award-y
domain.com/award-z

I need to find a way to contextually set the link in the taxonomy list block include that location vocabulary term, dynamically.

They NEED to look like the first set only with the location added dynamically:

domain.com/[florida]/award-x
domain.com/[usa]/award-x
domain.com/[north-america]/award-x

The problem is that we don't have the location term in the path. Any ideas on how to make this happen? Hope this makes sense.

Thanks in advance.

edited for clarification:

The end result I'm trying to achieve for the taxonomy link created by the View would look something like this:

domain.com/florida/award-x/node where florida

(the location) is added dynamically depending on the location taxonomy page that the visitor is on. I've not seen a way to set the location taxonomy term variable in to the path in admin/config/search/path/patterns which is where I've been looking the most for a solution. It seems I should be able to do it here, but I've not been able to figure it out due to the location being a different vocabulary that the award name.

  • Can you clarify what is / should be in url, block, and page in different situations? Pictures would really help. – Kari Kääriäinen Feb 6 '14 at 18:09
  • I edited it to show what I want to do. I'm not sure if images would be more helpful, but I'll see what I can do. – Rob Orr Feb 6 '14 at 21:15
0

You dont have to pass all these parameters via the URL. If you know the location or award from within your master view simply embed another View into the view passing it hidden or visible Fields in from the parent view. You want to use views_field_view to do this:

This module allows you to embed a view as a field in a view. A new field handler is made available, so this can also be used in area (header/footer/empty) handlers as well as rows.

This view handler can accept arguments from fields of the parent view using tokens and pass them into the child view for each row. Raw or rendered token values can be used, as well as static values.

It's highly recommended to use this module in conjunction with views caching. Views Content cache and Cache Actions are good ways of caching views.

0

I simplified this whole thing because it has to be done yesterday. I just manually created all the menus with the paths that I need. It's not elegant. It's probably not the best solution either for the future, but it had to get done. I created the first one I needed then, cloned it and adjusted the paths as needed for each additional menu.

We'll revisit this in the future, and I'd still like to hear other solutions, if someone has a better, more efficient, content manageable way of doing this, but for now the manual menus as blocks will have to work.

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.