Hi,
I'm hoping someone can help me out with a views problem. On my taxonomy pages I have a page view of nodes. Under the page view I wanted to add another view, either with a block view or by manually adding the view to my template file. However, I can't seem to get the fields in the view to display when I add taxonomy ID as an argument, nothing shows up. If I remove the argument the view displays so I'm sure it's a problem with the way I'm setting up arguments.
Basically, what I'm trying to achieve with the view is to display nodes from a certain content type under the taxonomy term that they belong to. This is what happens for the page view on the taxonomy term but I can't get it to work when adding a block view or view in my template.
Can anyone explain what I might be doing wrong and how to get this view to work?
Thanks for any help.
Comments
Block views don't use
Block views don't use arguments quite the same way as a page. You still add the argument in the argument section of the view, however you need to click on it and select to provide a default argument. Then you will be presented with a few options, one of them being to use PHP. Then write a few lines to pull the term from the URL.
Thanks for the help. Does
Thanks for the help. Does something like this look right (D6)?
If I try that it says _taxonomy_get_tid_from_term has already been declared, so obviously it's wrong but I'm a bit useless with php!
Thanks for any more help.
My new EasySnoozing, Nursing and BusinessEgghead websites on D7!
I have a "related news" block
I have a "related news" block that is basically a view of news with the same terms as the node content. I have Taxonomy: term id as an argument that is set to pull a default from php. Here is my code:
Thanks for your help. I'll
Thanks for your help. I'll see if I can adapt this to work on taxonomy pages. Thanks very much.
My new EasySnoozing, Nursing and BusinessEgghead websites on D7!
That snippet working fine with drupal 6.
Add this code in term id argument and then select php and insert following code.
$node = node_load(arg(1));
if($node){
foreach($node->taxonomy as $term) {$terms[] = $term->tid; }
return implode('+', $terms);
} else { return; }