Mason_vbulletin3_import15105
New Member
I have some content types (nodes) that are attached to various taxonomies. For specific node types, I want to do some validation on the taxonomy. I do not want to hard-code the nodes types and their corresponding fields that reference the taxonomy. So I put them in array. However, I am unable to dereference the field names. I've tried double $$, quotes, etc, but can't get it to work. Is what I want to do possible?Below is a standalone PHP that I am trying to get to work.\[code\]<?php$node = (object) array( 'nid' => NULL, 'vid' => NULL, 'uid' => '1', 'type' => 'price_document', 'language' => 'und', 'field_taxonomy_price' => array( 'und' => array( array( 'tid' => '94' ) ) ),); $nodes_to_check = array("price_document" => "field_taxonomy_price", "package" => "field_taxonomy_package", ); if (array_key_exists($node->type,$nodes_to_check)) { $taxonomy_field = $nodes_to_check[$node->type]; print_r($taxonomy_field); $tid = $node->field_taxonomy_price ['und'][0]['tid']; // <- this works but, how //$tid = $node->"$$taxonomy_field" ['und'][0]['tid']; <- can I deref variable? }?>\[/code\]