There is this very strange issue on the production server for only one content type that the breadcrumbs and node data do not render in the node view page.

But when we clear cache it shows the data for the node but when we refresh the page again then the data for that node is removed again. We have added some custom node variable using the hook_node_view those are also not visible. We have the same configuration of production server on the staging server where this is working fine. The code below is adding variable in the node view which is working fine every where except the production server.

PHP - 5.3.17

/*
 * Implementation of hook_node_view
 */
 
function mmt_flight_schedule_node_view($node, $view_mode, $langcode)
{
 // p($node);
	if($view_mode == 'full' && $node->type == 'flight_schedule_node')
	{       //p($node);
		//get the template configuration saved for this page number from city template node
		$template_data = _mmt_common_get_template_data('flight_schedule_template');
		
//set the meta information in node
		$token_data = array();
		$token_data = _mmt_common_get_token_data($node, $template_data);
		
	    _mmt_common_set_meta_fields($template_data, $node, $token_data);
	    
 	    //set the seo head information in node
		
	    _mmt_common_set_seo_information($template_data, $node, $token_data);
	    
	    //set node level information
	    $node = _mmt_common_set_node_info($template_data, $node, $token_data);
	    $src_city_taxo = taxonomy_term_load($node->field_flight_src_city['und'][0]['tid']);
            $desc_city_taxo = taxonomy_term_load($node->field_flight_dest_city['und'][0]['tid']);
            $node->src_city = $src_city_taxo->name;
            $node->dest_city = $desc_city_taxo->name;
	
	    $node = _mmt_flight_schedule_get_flight_view($node, $view_mode,$template_data,$token_data);
          //  p($template_data);
	    return $node;
   }
   

    if($view_mode == 'full' && $node->type == 'index_node_page' && $node->field_content_type['und']['0']['value'] =="flight_schedule_node")
	{
		$template_data = _mmt_common_get_template_data_index('index_page',$node->field_content_type['und']['0']['value']);
		$token_data = array();
		$token_data = _mmt_common_get_token_data($node, $template_data);
		_mmt_common_set_meta_fields($template_data, $node, $token_data);
		_mmt_common_set_seo_information($template_data, $node, $token_data);
		_mmt_common_set_node_info($template_data, $node, $token_data);
		$node->listing = mmt_flight_schedule_index_listing($node,$template_data->field_anchor_text['und']['0']['value']);		
		return $node;
	}
   
   
}

Content type is created using the feature module we thought that would be the problem after creating content type manually also it does not work. We are debugging but when we take backup of code and database from production on local and try it all things are working fine. Need to find why this is happening any help will be great.

Thanks,
Moneesh

Comments

moneeshk’s picture

Hi,

Does there is problem in the feature module because other content type created manually are working fine.

Thanks,
Moneesh

dotpex’s picture

You are doing it wrong.
Check again hook_node_view()

The module may add elements to $node->content prior to rendering.

You are returning $node but $node object are passed by reference.
try something like this:

  $node->content['my_custom_stuff'] = array(
    '#markup' => $my_custom_stuff, 
    '#weight' => 10, 
  );
moneeshk’s picture

I do understand the $node is passed by reference but this code is working fine on staging and local server where php version is 5.3.1 / 5.3.17
whereas in the server that is 5.3.17/ 5.4.8

If the code have the problem that should not worked in the staging and local environment.

dotpex’s picture

This is wrong:

 return $node;
moneeshk’s picture

Issue is resolved as we have single database and multiple frontend servers and during deployment we usually deploy code on one server and then check on that server and deploy on other server this is the usuall process.

But in this case as this is new module is enable on one server the cache table gets updated with its details. But when request on other frontend servers are coming it is updating the cache table with no data or hook implementation of that module and no code is executed that is written in the node view.

We resolve the issue by deploying the code on all the servers simultaneously.

Jaypan’s picture

This is wrong:

return $node;

No it's not. PHP 5.2 and below require the $node to be returned. 5.3 and above do not.