i want to add a block to the sidebar that will display any related nodes of a particular content type, in this case "video". i have created a view which shows all videos, and successfully put it in a block (i know, big deal) and now for the hard part. how to get it to only show the videos which share the same term id with the page the user is looking at.

for instance, if there's a page called "sharkbait", and sharkbait is also a term with the id 45, i want only videos tagged with "sharkbait" to show up on that page's sidebar. and then if they're looking at the "hockeypuck" page, only videos with tagged with "hockeypuck". you get the idea.

i've tried using a php block without any luck, but it seems like views is so close, i'm hoping i can make it work.

would it be possible, using arguments or argment handling code, to filter these out? i'm not good at writing php, but i can understand most of it when i read it.

any ideas? thanks!

Comments

dawehner’s picture

you have to do this using views arguments handling code

Add a argument tid and set this in the argument handling code

<?php
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) {
  $args[0] = arg(2);
   return $args;
}
?>
esmerel’s picture

Status: Active » Closed (fixed)

Suggested fix made.

jcharlesberry’s picture

Isn't there a way to do this using Views and Panels instead of using raw PHP?