DrupalCustom

Node_load

Feb 22nd, 2012
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. function freeway_node_load($node, $types) {
  2. global $language;
  3.  
  4. foreach($node as $n){
  5. $tempId = $n->nid;
  6. $tempSrcLang = $n->language;
  7. }
  8. $tempTarLang = $language->language;
  9.  
  10.   if ($tempSrcLang == en) {
  11.     $nodeSrc = 'en-us';
  12.  
  13.   }
  14.   if ($tempTarLang == fr) {
  15.     $frewayLang = 'fr-fr';
  16.   }
  17.   if ($tempTarLang == es) {
  18.     $frewayLang = 'es-es';
  19.   }
  20.  
  21.  
  22.  
  23.   // TODO Please convert this statement to the D7 database API syntax.
  24.   $result = db_query("SELECT node_title,node_body FROM {freeway}
  25.                      WHERE node_id = '$tempId'
  26.                      AND src_lang ='$nodeSrc'
  27.                      AND tar_lang='$frewayLang'");
  28.  
  29. $rowsUsPw = $result->rowCount();
  30.  
  31.  
  32.   foreach ($result as $record) {
  33.   foreach($node as $inner){
  34.            
  35.            
  36.             drupal_get_messages();
  37.             drupal_set_message("RecordArray>".$record->node_body);
  38.             drupal_goto("user");
  39.            
  40.            
  41.  
  42.         //$inner->body['und'][0]['value']= $record->node_body;
  43.        //$inner->body['und'][0]['value']= 'Test';
  44.         $inner->title = $record->node_title.'French';
  45.    
  46.     }
  47.    
  48.   }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment