如何在drupal 8中的page.html.twig中进行db_query调用?

时间:2016-06-17 07:29:02

标签: mysql drupal

我正在尝试从我的自定义页面树枝中调用数据库中的某些字段。 当我清除它抛出的缓存时,网站遇到意外错误。 你能否就org.apache.hadoop.mapred.YarnChild: Exception running child : java.lang.RuntimeException: Error while indexing: failure in bulk execution:MapperParsingException[failed to parse [endDate]]; nested: IllegalArgumentException[Invalid format: "253402214400000" is malformed at "02214400000" MapperParsingException[failed to parse [endDate]]; nested: IllegalArgumentException[Invalid format: "253402214400000" is malformed at "02214400000"]; MapperParsingException[failed to parse [endDate]]; nested: IllegalArgumentException[Invalid format: "253402214400000" is malformed at "02214400000"]; MapperParsingException[failed to parse [endDate]]; nested: IllegalArgumentException[Invalid format: "253402214400000" is malformed at "02214400000"]; MapperParsingException[failed to parse [endDate]]; nested: IllegalArgumentException[Invalid format: "253402214400000" is malformed at "02214400000"]; MapperParsingException[failed to parse [endDate]]; nested: IllegalArgumentException[Invalid format: "253402214400000" is malformed at "02214400000"]; 8?

的提示做出任何提示

1 个答案:

答案 0 :(得分:1)

twig模板不支持直接的php代码,首先你需要hook_page_preprocess()并在你的模板上实现它,你可以检查https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.php/group/themeable/8.2.x 感谢

相关问题