Hi there,

After much searching I finally found this module and thought it was exactly what I needed. I want to list nodes that are selectively attached to a term via the content taxonomy module. So I now see a few nodes attached in the content_field_taxo_listing table with their nids. So I built a view and used the following code:

$tid = 13; // still have to add code to get the term being viewed, used 13 cos I know it exists in the  content_field_taxo_listing table. 

$nodeids = array();

$my_result = db_query("SELECT nid FROM content_field_taxo_listing WHERE tid = '%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;

Nothing happens, after doing much reading and going through the examples I feel it should work. Am I making a fundamental error? Any PHP gurus out there willing to have a look?

Thanks.

Comments

ludo1960’s picture

Weird, the php returns the correct array ie nids 1 and 3 were returned but it shows everything else and not 1 and 3. Changing the operator to exclude these IDs has no effect! Result is the same?

gnassar’s picture

Take out $nodeids[1]=-1; I have no idea why people started putting it in their code, but it's a horrible idea. That might help.

gnassar’s picture

Though actually, if you know your code returns 1 and 3, but the filter has no effect on nodes 1 and 3, it sounds like those two nodes are being filtered out earlier in the filter chain. If other filters take those nodes out of the result set, there's nothing my filter can do to put them back in.