0

first post, here goes, I want to get the tid from the taxonomy/term/% taxonomy menu to look up a query on a cck table to pass an array of nids to filter a views block view. I can get the tid of the term being viewed and I can get the view to accept an array of nids, just can't figure out the bit in between. D6 BTW, got panels if that makes it any easier! Some of the stuff I have read says its easier done with panels. But I'm stumped!

7
  • Can you be a little more specific? What do you mean by "the bit in between"? Are you using a contextual filter in your view? Dec 17, 2011 at 21:24
  • Thanks for reply, the url is taxonomy/term/13 say, then I want to look up mmy cck table and get the nids of the nodes that have 13 in a particular field, then pass the nids back to the views block that will take the nids as an argument. Does that make sense?
    – user4560
    Dec 18, 2011 at 3:57
  • how are you "looking up [your] cck table?" this sounds like a filter/argument/relationship in a view to me. Meaning, you have the 13 right there in the url, so you have the information to do everything all in one big view.
    – Jimajamma
    Dec 18, 2011 at 4:30
  • Hi, That's what I thought initially but I can't see any relations available for the CCK table that would help me. Here's how I grab the nids: $my_result = db_query("SELECT nid FROM content_field_taxo_listing WHERE field_taxo_listing_value = '%s'", $tid); $nodeids[1] = -1; // This ensures that if there are no results from the database query, you won't get an error from passing back an empty array. while ($my_row = db_fetch_array($my_result)) { $nodeids[] = $my_row['nid']; } return $nodeids;
    – user4560
    Dec 18, 2011 at 4:41
  • Hmm, wait a minute. In relationship I have the content_field_taxo_listing field that has 13 in it. So I added a relationship, Used Term ID as argument (term id from URL as default argument) Got rid of the viewsphpfilter stuff. Sp when I hit preview with no argument, there are the 2 nodes I am looking for node 1 and node 3, but when I enter 13 as argument I see nothing in the views preview, something wrong with the argument?
    – user4560
    Dec 18, 2011 at 5:13

1 Answer 1

1

If what you want to do is create a list of nodes (or fields of nodes rather) that have a certain $tid, you would create a view, probably filter it on node type and if it's published, put $tid in as an argument to further filter things based on it, select whatever fields in the nodes that pass all of these you want displayed, and then over on the top left of the form, add a block display, name it whatever you want, save it all, then go into your Blocks admin page and put that block in whatever region of your theme you want. (Or at this point use panels, but I don't, so don't know how lol) And take a couple breaths in between all of these steps :)

ADD: Check out the http://mustardseedmedia.com/podcast/episode31 video as Bob there answers in great depth how to adjust your views to do what I think you are attempting here, and can answer all the details you need a lot easier than me going into that detail here.

3
  • Cant use Term Id as argument, if you read my comment above. Thanks for input!
    – user4560
    Dec 18, 2011 at 3:59
  • Umm, I answered 6 hours before your comment, so, no, didn't read it. Good luck!
    – Jimajamma
    Dec 18, 2011 at 4:05
  • I'm new round here, I meant the reply I made to Krister! Soz for confusion.
    – user4560
    Dec 18, 2011 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.