views:

23

answers:

0
function my_content_view($node, $teaser = FALSE, $page = FALSE){
   $my_data_table = array(
      'personal_info' => array(
         'gender' => array('M' => t('Male Only'),'F' => t('Female Only'),'MF' => t('Both Gender Allow'),),                    
       ),
   );    

   $node = node_prepare($node, $teaser);

   if($page){    
      //$node->gender stores key
      $gender = $my_data_table['personal_info']['gender'][$node->gender];
      $node->content['my_content'] = array(
         '#value' => theme('default_template', $gender),
         '#weight' => 1,
      );    
   }

   return $node;
}

In above code, I'm passing value from an array keyed based on the data stored in database to my default node template. There's also custom node template which I've created separately and placed inside the directory where custom themes are stored. The problem I'm having is, $node is not properly passed to my node template in a sense that, inside node template, the value I get is the value returns from database which is just an array key;not the value I passed using theme_hook - '#value' => theme('default_template', $gender). To give you an example, suppose $node->gender stores 'M', instead of $gender having 'Male Only' value, it holds 'M' value inside my node template. Can anyone tell me where I am doing wrong? I could override the $node->gender with the value I desire but then again, that's not what drupal documentation suggests.

drupal (6.x)