Forum Moderators: open
as a page, but we cannot assign a specific taxonomy term to a specific instance of that view.
The view itself is pulling in lists of nodes based off of a taxonomy argument.
On the bottom left, we have some callouts, but they're shown randomly because we can’t assign a term to that page to show specific callouts.
So, how can we tie a term to that specific page?
There's 7-8 of these pages, and they all use the same View, but just passing different data through the argument.
Without changing the view output (for example, from a page to a block), how can this be accomplished?
We tried adding the taxonomy term into the URL, but as expected, it doesnt work right since the relationship is assumedly in the database, not the
URL.
And pushing the taxonomy term / term ID into the URL would be a less preferred method since the client would likely not be able to manage it.
Is there an easy way to associate a taxonomy term to a View page similar to the method of assigning a taxonomy term during a page/node creation?
[edited by: ergophobe at 12:07 am (utc) on Dec. 31, 2009]
[edit reason] No personal URLs please as per TOS [/edit]
Unfortunately, only nodes can be assigned to taxonomy terms. I'm trying to think of what alternatives you have.
Having Views handle taxonomy display is the obvious one. Are you using normal taxonomy?
Other than that, using the URL or changing the View display to a block and embedding that in the page are the other obvious ones.
All of those have limitations you want to avoid, though, so I'm not sure what to suggest.
Just curious, but why are you against displaying the View as a block? Too difficult to manage for the client in the end I suppose.
Sort of thinking randomly out loud here....
What is the data in the callout blocks? Could you use the Views attachment feature instead, so you would attach output to a view? Getting it to display like you want might be a challenge though.
We're using the normal built-in taxonomy system.
Right now, we have a custom content type for the admin to create "shows", and for each show, they can categorize them through the taxonomy system that is tied to that custom content type.
And we have a view that filters by content type (show), and we're passing an argument through the URL to apply a dynamic filter on which taxonomy term to further filter by.
We need the argument because the view is used 7-8 times, and the number of these view instances will grow over time. So it needs to be fairly easy to manage. The output is the same, but the content it gives back in the end is slightly different since it is passing a different taxonomy term, thus grabbing different nodes from the CMS.
I tried to use the Block form when I first starting working on this, but I couldn't get it to work without a lot of manual setup (making a block per taxonomy term / combination). I setup a quick testing version to try it again.
I have a testing holding page, with the Views block added to the page.
The block is the part with "Body:", "test body 1", through "test content 3".
Each of those "test pages" have a different taxonomy term to it.
The view is setup to use an argument to apply the final filter, but when I append my argument to the URL.
I get a "Page Not Found". I figure I can get around this by making a different block for each taxonomy term needed and tie those to a specific page, but that goes down to the fact that non-technical client needs to be able to manage this one day. If neccessary, we can possibly do this, but I was hoping for a different / more elegant solution. But I'm at a loss without having to create a custom module or manager for this.
In regards to the callout blocks, the data is just an image the client uploads. There's a taxonomy vocab to handle it, and each "group" of callouts are tied to a term. The client uses this "callout manager" to make new callouts and tie them to a specific term. Then on each page/node they just choose which taxonomy term they want, and the right callouts appear.
But as I've found, and as you've mentioned, that kind of feature really only belongs to the page/node feature.
So, from what I gather, there's not much I can do besides redo how the View pushes to the page (from a page to a block) or make a custom module to manage this from a different angle, correct?
[edited by: ergophobe at 4:42 pm (utc) on Dec. 31, 2009]
[edit reason] No promotional URLs as per TOS [/edit]
I ask, because you can manually include Views in your template. I've had to do it in some cases because of similar limitations with taxonomy and Views.
So you do some custom PHP processing and then feed that build your own view from your template, rather than from the Views UI.
For pulling views into a node, are you referring to a module to do that? I'm aware of using a block to do that, but how else can you pull a view display into a node?
The screen where you define Views in Drupal is just the Views UI and all it's doing is generating the code for a View and setting up the way to include it in a node.
So what you want to do is figure out what parameters you need to feed to a View and how to call that out in a node.
So basically, you create a content type and create a template file for that content type.
Then you can parse the URL for any node, and figure out what you want to feed to the View and how to build it in your page, and then your node is part of the taxonomy, the View is adapted based on URL (and thus taxonomy if your URL maps to taxonomy) and then your callouts work as expected.
Since you're using a custom content type, you should be good.
So, for example, in one case, I'm doing this in a template file to grab a view and feeding it an argument.
$view = views_get_view('user_contributions');
$view->set_display('block_1');
$view_output = $view->preview('block_1', array($node->uid));
I have a view that I call in over 20 different ways by passing in 0-3 filters programatically. Heck it even handles 2 countries and 2 different languages!